Sometimes EAs do strange things when return is used instead of return(0)
New_Bar is unnecessary in your code. You assign the value true and then immediately check that it ==true, both actions contained in the same if{}
int start() { double x1,x2,x3,xp1,xp2; static datetime New_Time=0; if(New_Time!=Time[0]) { New_Time=Time[0]; x1= iCustom("EURUSD",PERIOD_M1,"Osci",alpha,lag_signal2,is_median,0,1); x2= iCustom("EURUSD",PERIOD_M1,"Osci",alpha,lag_signal2,is_median,1,1); x3= iCustom("EURUSD",PERIOD_M1,"Osci",alpha,lag_signal2,is_median,2,1); xp1= iCustom("EURUSD",PERIOD_M1,"Osci",alpha,lag_signal2,is_median,0,2); xp2= iCustom("EURUSD",PERIOD_M1,"Osci",alpha,lag_signal2,is_median,1,2); if (x1>=x2 && xp1<=xp2) { Alert("buy"); return(0); } if (x1<=x2 && xp1>=xp2) { Alert("sell"); return(0); } } //---- return(0); } //+------------------------------------------------------------------+
cryptex: "custom indicator oscillator removed." Just for convenience the indicator is also display on the terminal. so every time there an alert, the indicator window freezes and i have to switch back and forth between time frames. Can someone throw some light on why this might be happening.
Because the indicator is broken, you don't have a pair "EURUSD" or M1 history. Fix the indicator, the problem has nothing to do with the EA.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
With the help of forum members i have been able to put together an EA. Now while my EA was running i noticed that every time the EA generated an alert, the journal shows "custom indicator oscillator removed." Just for convenience the indicator is also display on the terminal. so every time there an alert, the indicator window freezes and i have to switch back and forth between time frames. Can someone throw some light on why this might be happening.
The EA is programmed is to generate an alert based on the previous bar's data. So in my opinion if the conditions are met every alert should be generated within a sec or two after the previous bar is over. this EA takes up to 16 secs to generate an alert. i have managed to work around this issue; i have copied the same indicator to a new indicator and have set the EA to call the new indicator and display the old indicator in the window. But i would still like to know what might be causing this freezing?