Rejoindre la communauté
banner_forum
Devenez membre de la plus grande
communauté francophone sur le Forex
Partagez, échangez et apprenez en gagnant des crédits sur votre compte de trading

Alerte sonore RSA

  • la-fourmi

    Bonjour,
    quelqu'un sait -l comment installer un signal sonore qui avertirait quand le RSA changerait de sens ?
    merci
  • AliX

    Hello, je relance ton sujet en espérant qu'un addict du code te réponde, il y a beaucoup de sujet similaire sur le forum que j'ai trouvé grâce à la barre de recherche mais aucun qui donne réponse à ta demande
  • rlrl39705

    Salut, j'aurais bien répondu, mais je ne vois pas ce qu'est le RSA.
    A moins que tu voulais dire RSI, dans ce cas il te faut un indicateur custom simplement basé sur le RSI :

    Je viens de faire ça, teste si ça te conviens.

    Code
    //+------------------------------------------------------------------+ //| R_RSI_Alert.mq4 | //| Copyright 2022, remjie | //+------------------------------------------------------------------+ #property copyright "remjie" #property link "" #property description "RSI alerte" #property strict //--- indicator settings #property indicator_minimum 0 #property indicator_maximum 100 #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 Red #property indicator_color3 Green #property indicator_width1 1 #property indicator_width2 1 #property indicator_width3 1 //--- indicator parameters input int mPeriod=14; // Periode input double mBorne=20; // Filtre //--- other param double Hborne, Lborne; int alert; //--- indicator buffers calc double mRSI; double oRSI; //--- indicator buffers draw double UpBuffer[]; double DownBuffer[]; double NoneBuffer[]; //--- right input parameters flag bool ExtParameters=false; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit(void) { IndicatorBuffers(3); IndicatorDigits(Digits+1); //--- drawing settings SetIndexStyle(0,DRAW_LINE); SetIndexStyle(1,DRAW_LINE); SetIndexStyle(2,DRAW_LINE); //--- indicator buffers mapping SetIndexBuffer(0,NoneBuffer); SetIndexBuffer(1,DownBuffer); SetIndexBuffer(2,UpBuffer); //--- name for DataWindow and indicator subwindow label IndicatorShortName("R_RSI_Alert("+IntegerToString(mPeriod)+")"); SetIndexLabel(0,"Range"); SetIndexLabel(1,"Oversold"); SetIndexLabel(2,"Overbought"); //--- check for input parameters alert = 0; Hborne = 100 - mBorne; Lborne = mBorne; //--- initialization done return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Moving Averages Convergence/Divergence | //+------------------------------------------------------------------+ int OnCalculate (const int rates_total, const int prev_calculated, const datetime& time[], const double& open[], const double& high[], const double& low[], const double& close[], const long& tick_volume[], const long& volume[], const int& spread[]) { int i,limit; //--- //--- last counted bar will be recounted limit=rates_total-prev_calculated; if(prev_calculated>0) limit++; //--- calc for(i=0; i<limit; i++) { mRSI = iRSI(NULL,0,mPeriod,PRICE_CLOSE,i); NoneBuffer[i]=mRSI; // show if(mRSI > Hborne ) { UpBuffer[i] = mRSI; } if(mRSI < Lborne ) { DownBuffer[i] = mRSI; } } if(iRSI(NULL,0,mPeriod,PRICE_CLOSE,1)>Hborne && iRSI(NULL,0,mPeriod,PRICE_CLOSE,0)<=Hborne && alert != 1) { Alert("le RSI sort de sur-ACHAT"); alert = 1; } else if(iRSI(NULL,0,mPeriod,PRICE_CLOSE,1)<Lborne && iRSI(NULL,0,mPeriod,PRICE_CLOSE,0)>=Hborne && alert != 2) { Alert("le RSI sort de sur-VENTE"); alert = 2; } else if(iRSI(NULL,0,mPeriod,PRICE_CLOSE,1)>Lborne && iRSI(NULL,0,mPeriod,PRICE_CLOSE,0)> Lborne && alert == 2) { alert = 0; } else if(iRSI(NULL,0,mPeriod,PRICE_CLOSE,1)<Hborne && iRSI(NULL,0,mPeriod,PRICE_CLOSE,0)< Hborne && alert == 1) { alert = 0; } //--- done return(rates_total); } //+------------------------------------------------------------------+
  • la-fourmi

    Bonjour,
    Merci à ceux qui ont tenté de répondre à ma question. Je comprends leur embarras. Il ne s'agissait pas de créer une alerte pour un indicateur qui n'existe pas le rsa.. En fait j'ai voulu écrire le SAR , qui lui existe bien.
    Mes excuses à tous ! je promets de relire mes messages attentivement .
  • rlrl39705

    Effectivement, ça a plus de sens.
    Apres il suffisait d'adapter, teste ça.

    Code
    //+------------------------------------------------------------------+ //| R_SAR_Alert.mq4 | //| Copyright 2022, remjie | //+------------------------------------------------------------------+ #property copyright "remjie" #property link "" #property description "SAR alerte" #property strict //--- indicator settings #property indicator_buffers 2 #property indicator_color1 Green #property indicator_color2 Red #property indicator_width1 1 #property indicator_width2 1 //--- indicator parameters input double mPas=0.02; // Pas input double mMax=0.2; // Maximum //--- indicator buffers calc int alert = 0; double mSAR; //--- indicator buffers draw double UpBuffer[]; double DownBuffer[]; //--- right input parameters flag bool ExtParameters=false; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit(void) { IndicatorBuffers(2); IndicatorDigits(Digits+1); //--- drawing settings SetIndexStyle(0,DRAW_ARROW); SetIndexStyle(1,DRAW_ARROW); //--- indicator buffers mapping SetIndexBuffer(0,UpBuffer); SetIndexBuffer(1,DownBuffer); SetIndexArrow(0,159); SetIndexArrow(1,159); //--- name for DataWindow and indicator subwindow label IndicatorShortName("R_SAR_Alert("+DoubleToString(mPas)+","+DoubleToString(mMax)+")"); SetIndexLabel(0,"Achat"); SetIndexLabel(1,"Vente"); //--- initialization done return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Moving Averages Convergence/Divergence | //+------------------------------------------------------------------+ int OnCalculate (const int rates_total, const int prev_calculated, const datetime& time[], const double& open[], const double& high[], const double& low[], const double& close[], const long& tick_volume[], const long& volume[], const int& spread[]) { int i,limit; //--- //--- last counted bar will be recounted limit=rates_total-prev_calculated; if(prev_calculated>0) limit++; //--- calc for(i=0; i<limit; i++) { mSAR = iSAR(NULL,0,mPas,mMax,i); // show if( mSAR > Close[i]) DownBuffer[i] = mSAR; else if( mSAR < Close[i]) UpBuffer[i] = mSAR; } if( iSAR(NULL,0,mPas,mMax,0) > Close[0] && iSAR(NULL,0,mPas,mMax,1) < Close[1] && alert != 2) { Alert("le SAR(",mPas,",",mMax,") : VENTE"); alert = 2; } else if(iSAR(NULL,0,mPas,mMax,0) < Close[0] && iSAR(NULL,0,mPas,mMax,1) > Close[1] && alert != 1) { Alert("le SAR(",mPas,",",mMax,") : ACHAT"); alert = 1; } //--- done return(rates_total); } //+------------------------------------------------------------------+

    PS: si tu as une stratégie a base de SAR je suis prenneur.