sharaz.sharif:
Hello dear MQL5 community
I'm looking for an indicator for the MT5 which sends me an alert on the Computer and on the mobile device as well, when two Moving Averages crossing with each other (the days have to be self-adjusting). Is there such an indicator on the market which I can download or buy? If not, can someone develop that for me? How much will it cost?
I am very grateful for any helpful advise!
Kind regards
Sharaz
Hello dear MQL5 community
I'm looking for an indicator for the MT5 which sends me an alert on the Computer and on the mobile device as well, when two Moving Averages crossing with each other (the days have to be self-adjusting). Is there such an indicator on the market which I can download or buy? If not, can someone develop that for me? How much will it cost?
I am very grateful for any helpful advise!
Kind regards
Sharaz
I found a good one.
#property indicator_chart_window //----two buffers are used for calculation of drawing of the indicator #property indicator_buffers 2 //---- only two plots are used #property indicator_plots 2 //+----------------------------------------------+ //| Parameters of drawing the bearish indicator | //+----------------------------------------------+ //---- drawing the indicator 1 as a symbol #property indicator_type1 DRAW_ARROW //---- red color is used for the indicator bearish line #property indicator_color1 Red //---- thickness of line of the indicator 1 is equal to 4 #property indicator_width1 4 //---- displaying the bearish label of the indicator line #property indicator_label1 "MA-Crossover_Alert Sell" //+----------------------------------------------+ //| Bullish indicator drawing parameters | //+----------------------------------------------+ //---- drawing the indicator 2 as a line #property indicator_type2 DRAW_ARROW //---- lime color is used as the color of the bullish indicator line #property indicator_color2 Lime //---- thickness of the indicator line 2 is equal to 4 #property indicator_width2 4 //---- displaying of the bullish label of the indicator #property indicator_label2 "MA-Crossover_Alert Buy" //+----------------------------------------------+ //| Declaration of enumerations | //+----------------------------------------------+ enum Smooth_Method { MODE_SMA_, //SMA MODE_EMA_, //EMA MODE_SMMA_, //SMMA MODE_LWMA_, //LWMA MODE_LSMA_ //LSMA }; //+----------------------------------------------+ //| Declaration of constants | //+----------------------------------------------+ #define RESET 0 // the constant for getting the command for the indicator recalculation back to the terminal //+----------------------------------------------+ //| Indicator input parameters | //+----------------------------------------------+ input Smooth_Method FastMA_Mode=MODE_EMA_; //Smoothing method for fast moving input uint FastMA_Period=5; //Period of averaging for fast moving input ENUM_APPLIED_PRICE FastPriceMode=PRICE_CLOSE;//Price for fast moving input Smooth_Method SlowMA_Mode=MODE_EMA_; //Smoothing method for slow moving input uint SlowMA_Period=20; //Period of averaging for slow moving input ENUM_APPLIED_PRICE SlowPriceMode=PRICE_CLOSE;//Price for slow moving extern bool SoundON=true; //Alert extern bool EmailON=false; //Email input uint NumberofAlerts=2; //+----------------------------------------------+ //---- declaration of dynamic arrays that // will be used as indicator buffers double SellBuffer[]; double BuyBuffer[]; //---- uint counter=0; bool flagval1 = false; bool flagval2 = false; //----Declaration of variables for storing the indicators handles int FaMA_Handle,SlMA_Handle; //---- declaration of the integer variables for the start of data calculation int StartBars; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { //---- initialization of variables of the start of data calculation StartBars=int(MathMax(FastMA_Period,SlowMA_Period)+3+9); //---- obtaining the indicators handles if(FastMA_Mode!=MODE_LSMA_) { FaMA_Handle=iMA(NULL,0,FastMA_Period,0,ENUM_MA_METHOD(FastMA_Mode),FastPriceMode); if(FaMA_Handle==INVALID_HANDLE)Print(" Failed to get handle of the FaMA indicator"); } if(SlowMA_Mode!=MODE_LSMA_) { SlMA_Handle=iMA(NULL,0,SlowMA_Period,0,ENUM_MA_METHOD(SlowMA_Mode),SlowPriceMode); if(SlMA_Handle==INVALID_HANDLE)Print(" Failed to get handle of the SlMA indicator"); } //---- set dynamic array as an indicator buffer SetIndexBuffer(0,SellBuffer,INDICATOR_DATA); //---- shifting the start of drawing of the indicator 1 PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,StartBars); //---- indicator symbol PlotIndexSetInteger(0,PLOT_ARROW,234); //---- setting the indicator values that won't be visible on a chart PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0); //---- indexing elements in the buffer as in timeseries ArraySetAsSeries(SellBuffer,true); //---- set dynamic array as an indicator buffer SetIndexBuffer(1,BuyBuffer,INDICATOR_DATA); //---- shifting the start of drawing of the indicator 2 PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,StartBars); //---- indicator symbol PlotIndexSetInteger(1,PLOT_ARROW,233); //---- setting the indicator values that won't be visible on a chart PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0); //---- indexing elements in the buffer as in timeseries ArraySetAsSeries(BuyBuffer,true); //---- Setting the format of accuracy of displaying the indicator IndicatorSetInteger(INDICATOR_DIGITS,_Digits); //---- name for the data window and the label for sub-windows string short_name="MA-Crossover_Alert"; IndicatorSetString(INDICATOR_SHORTNAME,short_name); //---- } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //---- //---- } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ 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[]) { //---- checking the number of bars to be enough for the calculation if(rates_total<StartBars) return(RESET); if(FastMA_Mode!=MODE_LSMA_&&BarsCalculated(FaMA_Handle)<rates_total) return(RESET); if(SlowMA_Mode!=MODE_LSMA_&&BarsCalculated(SlMA_Handle)<rates_total) return(RESET); //---- declaration of local variables int limit,count; double fastMAnow,slowMAnow,fastMAprevious,slowMAprevious,Range,AvgRange,MA[],Ask,Bid; string text,sAsk,sBid,sPeriod; //---- calculations of the necessary amount of data to be copied //---- and the 'limit' starting index for the bars recalculation loop if(prev_calculated>rates_total || prev_calculated<=0)// checking for the first start of the indicator calculation { limit=rates_total-StartBars; // starting index for calculation of all bars } else { limit=rates_total-prev_calculated; // starting index for calculation of new bars } //---- indexing elements in arrays as time series ArraySetAsSeries(open,true); ArraySetAsSeries(high,true); ArraySetAsSeries(low,true); ArraySetAsSeries(close,true); ArraySetAsSeries(MA,true); //---- main loop of the indicator calculation for(int bar=limit; bar>=0; bar--) { count=bar; Range=0; AvgRange=0; for(count=bar;count<=bar+9;count++) AvgRange=AvgRange+MathAbs(high[count]-low[count]); Range=AvgRange/10; if(FastMA_Mode==MODE_LSMA_) { fastMAnow=LSMA(open,high,low,close,FastMA_Period,FastPriceMode,bar); fastMAprevious=LSMA(open,high,low,close,FastMA_Period,FastPriceMode,bar+1); } else { //--- copy newly appeared data in the array if(CopyBuffer(FaMA_Handle,0,bar,2,MA)<=0) return(RESET); fastMAnow=MA[0]; fastMAprevious=MA[1]; } if(SlowMA_Mode==MODE_LSMA_) { slowMAnow=LSMA(open,high,low,close,SlowMA_Period,SlowPriceMode,bar); slowMAprevious=LSMA(open,high,low,close,SlowMA_Period,SlowPriceMode,bar+1); } else { //--- copy newly appeared data in the array if(CopyBuffer(SlMA_Handle,0,bar,2,MA)<=0) return(RESET); slowMAnow=MA[0]; slowMAprevious=MA[1]; } BuyBuffer[bar]=0.0; SellBuffer[bar]=0.0; if(fastMAnow>slowMAnow && fastMAprevious<slowMAprevious) { if(bar==1 && !flagval1) { flagval1=true; flagval2=false; } BuyBuffer[bar]=low[bar]-Range*0.75; } if(fastMAnow<slowMAnow && fastMAprevious>slowMAprevious) { if(bar==1&!flagval2) { flagval2=true; flagval1=false; } SellBuffer[bar]=high[bar]+Range*0.75; } } if(rates_total!=prev_calculated) counter=0; if(BuyBuffer[1]&&counter<=NumberofAlerts) { counter++; MqlDateTime tm; TimeToStruct(TimeCurrent(),tm); text=TimeToString(TimeCurrent(),TIME_DATE)+" "+string(tm.hour)+":"+string(tm.min); Ask=close[0]; Bid=close[0]+spread[0]; sAsk=DoubleToString(Ask,_Digits); sBid=DoubleToString(Bid,_Digits); sPeriod=EnumToString(ChartPeriod()); if(SoundON) Alert("BUY signal at Ask=",Ask,"\n Bid=",Bid,"\n currtime=",text,"\n Symbol=",Symbol()," Period=",sPeriod); if(EmailON) SendMail("BUY signal alert","BUY signal at Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod); } if(SellBuffer[1]&&counter<=NumberofAlerts) { counter++; MqlDateTime tm; TimeToStruct(TimeCurrent(),tm); text=TimeToString(TimeCurrent(),TIME_DATE)+" "+string(tm.hour)+":"+string(tm.min); Ask=close[0]; Bid=close[0]+spread[0]; sAsk=DoubleToString(Ask,_Digits); sBid=DoubleToString(Bid,_Digits); sPeriod=EnumToString(ChartPeriod()); if(SoundON) Alert("SELL signal at Ask=",sAsk,"\n Bid=",sBid,"\n Date=",text,"\n Symbol=",Symbol()," Period=",sPeriod); if(EmailON) SendMail("SELL signal alert","SELL signal at Ask="+sAsk+", Bid="+sBid+", Date="+text+" Symbol="+Symbol()+" Period="+sPeriod); } //---- return(rates_total); } //+------------------------------------------------------------------+ //| LSMA with PriceMode | //+------------------------------------------------------------------+ double LSMA ( const double &Open[], const double &High[], const double &Low[], const double &Close[], int Rperiod, ENUM_APPLIED_PRICE prMode, int shift ) { //---- int i; double sum,pr; int length; double lengthvar; double tmp; double wt; length=Rperiod; sum=0; for(i=length; i>=1; i--) { lengthvar = length+1; lengthvar/= 3; tmp=0; switch(prMode) { case PRICE_CLOSE: pr= Close[length-i+shift];break; case PRICE_OPEN: pr = Open[length-i+shift];break; case PRICE_HIGH: pr = High[length-i+shift];break; case PRICE_LOW: pr=Low[length-i+shift];break; case PRICE_MEDIAN: pr=(High[length-i+shift]+Low[length-i+shift])/2;break; case PRICE_TYPICAL: pr=(High[length-i+shift]+Low[length-i+shift]+Close[length-i+shift])/3;break; case PRICE_WEIGHTED: pr=(High[length-i+shift]+Low[length-i+shift]+Close[length-i+shift]+Close[length-i+shift])/4;break; } tmp = ( i - lengthvar)*pr; sum+=tmp; } wt=sum*6/(length*(length+1)); //---- return(wt); } //+------------------------------------------------------------------+
I tried this indi, and the alerts keep coming even after switching off!

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm looking for an indicator for the MT5 which sends me an alert on the Computer and on the mobile device as well, when two Moving Averages crossing with each other (the days have to be self-adjusting). Is there such an indicator on the market which I can download or buy? If not, can someone develop that for me? How much will it cost?
I am very grateful for any helpful advise!
Kind regards
Sharaz