Bonjour,
quelqu'un sait -l comment installer un signal sonore qui avertirait quand le RSA changerait de sens ?
merci
quelqu'un sait -l comment installer un signal sonore qui avertirait quand le RSA changerait de sens ?
merci
La garantie Forexagone permet de vous assurer que votre gain ne soit pas perdu. Nous négocions les meilleurs taux avec les brokers agréés par l’AMF.
//+------------------------------------------------------------------+
//| 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);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| 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);
}
//+------------------------------------------------------------------+