Hello,
I found this piece of indicator on the net. Once installed it displays old alerts but not the new alerts.
I am beginner with mql, and I don't understand why, if someone could help thanks in advance.
#property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 SeaGreen #property indicator_color2 Red #property strict; datetime prevtime; double CrossUp[]; double CrossDown[]; extern int FasterEMA = 3; extern int SlowerEMA = 7; extern int TrendEMA = 200; extern bool SoundON=true; input int ArrowRange=25;// Range double alertTag; extern bool CepUyariGonder=false; // Send Cell Phone Notificatiom //extern bool SMSGonder=true;// Send Cell Phone SMS extern bool SesliAlarm=true; // Sound Alert double control=2147483647; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0, DRAW_ARROW, EMPTY,3); SetIndexArrow(0, 233); SetIndexBuffer(0, CrossUp); SetIndexStyle(1, DRAW_ARROW, EMPTY,3); SetIndexArrow(1, 234); SetIndexBuffer(1, CrossDown); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } bool NewBar() { static datetime lastbar; datetime curbar = Time[0]; if(lastbar!=curbar) { lastbar=curbar; return (true); } else { return(false); } } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit, i; double fasterEMAnow, slowerEMAnow, fasterEMAprevious, slowerEMAprevious, fasterEMAafter, slowerEMAafter; double trendEMAnow; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars-1; for(i = 0; i <= limit; i++) { fasterEMAnow = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i); fasterEMAprevious = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i+1); fasterEMAafter = iMA(NULL, 0, FasterEMA, 0, MODE_EMA, PRICE_CLOSE, i-1); slowerEMAnow = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, PRICE_CLOSE, i); slowerEMAprevious = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, PRICE_CLOSE, i+1); slowerEMAafter = iMA(NULL, 0, SlowerEMA, 0, MODE_EMA, PRICE_CLOSE, i-1); trendEMAnow = iMA(NULL, 0, TrendEMA, 0, MODE_EMA, PRICE_CLOSE, i); if ((fasterEMAnow > slowerEMAnow) && (fasterEMAprevious < slowerEMAprevious) && (fasterEMAafter > slowerEMAafter) && (fasterEMAnow > trendEMAnow)) { CrossUp[i] = Low[i] - ArrowRange*Point; } else if ((fasterEMAnow < slowerEMAnow) && (fasterEMAprevious > slowerEMAprevious) && (fasterEMAafter < slowerEMAafter) && (fasterEMAnow < trendEMAnow)) { CrossDown[i] = High[i] + ArrowRange*Point; } } /* if (SoundON==true && i==1 && CrossUp[i] > CrossDown[i] && alertTag!=Time[0]){ Alert("EMA Cross Trend going Down on ",Symbol()," ",Period()); alertTag = Time[0]; } if (SoundON==true && i==1 && CrossUp[i] < CrossDown[i] && alertTag!=Time[0]){ Alert("EMA Cross Trend going Up on ",Symbol()," ",Period()); alertTag = Time[0]; } */ if(Time[0] == prevtime) return(0); prevtime = Time[0]; if(CrossUp[1]!=2147483647 && CrossUp[1]>0) { if(NewBar()) { if(SesliAlarm) Alert(Symbol()+" TF:"+string(Period())+" MA SYSTEM BUY!."); if(CepUyariGonder) SendNotification("Haskaya "+Symbol()+" TF:"+IntegerToString(Period())+ " MA SYSTEM BUY!.") ; } } if(CrossDown[1]!=2147483647 && CrossDown[1]>0) { if(NewBar()) { if(SesliAlarm) Alert(Symbol()+" TF:"+string(Period())+" MA SYSTEM SELL!."); if(CepUyariGonder) SendNotification("Haskaya "+Symbol()+" TF:"+IntegerToString(Period())+ " MA SYSTEM SELL!.") ; } } return(0); }
Thanks for your reply but having a lot of errors...
I don't understand mql4 program structure
What I would like is to understand why is it not working.
I am PHP programmer so I should be able to understand.
mql is a very strange langage...
Thanks for your reply but having a lot of errors...
I don't understand mql4 program structure
There is not a single error or warning message in the piece of code I sent you. Testing has been done.
if(Time[0] == prevtime)
And thanks it works, I don't really understand why the code I posted does not work...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I found this piece of indicator on the net. Once installed it displays old alerts but not the new alerts.
I am beginner with mql, and I don't understand why, if someone could help thanks in advance.