The D1 values are updating. Use something like
ResetLastError(); curtime=iTime(Symbol(),PERIOD_D1,0); if(GetLastError()==4066) { Sleep(10000); curtime=iTime(Symbol(),PERIOD_D1,0); } if(curtime>prevtime && IsConnected()==true) { //your code // }
or put the EA on the daily chart
if(iIchimoku(Symbol(),PERIOD_D1,9,26,52,MODE_SENKOUSPANA,-24) ...The last parameter of the iIchimoku - MQL4 Documentation is the shift, the bar you want the value for. The current bar is zero, the previous bar is one. You are asking for the future.
The D1 values are updating. Use something like
or put the EA on the daily chart
The last parameter of the iIchimoku - MQL4 Documentation is the shift, the bar you want the value for. The current bar is zero, the previous bar is one. You are asking for the future.
The D1 values are updating. Use something like
or put the EA on the daily chart
Ok I tried this, but the problem is I am running the alert from a custom indicator - and the Sleep() function can't be called from an indicator. Any work around?
Thanks!
Richard
Ok I tried this, but the problem is I am running the alert from a custom indicator - and the Sleep() function can't be called from an indicator. Any work around?
Thanks!
Richard
Sorry, you did say it is an indicator. I should pay more attention :)
You could try
ResetLastError(); curtime=iTime(Symbol(),PERIOD_D1,0); if(GetLastError()==4066) { return(0); }
That way it will return and try again the next tick.
There is a problem with checking for error 4066 in a loop, because the error is only returned once. I've never tested it to see if the error is returned in subsequent calls on start()
GumRai:
That way it will return and try again the next tick.
There is a problem with checking for error 4066 in a loop, because the error is only returned once. I've never tested it to see if the error is returned in subsequent calls on start()

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi!
I have coded an alert for my Ichimoku trading, all it does is check for available conditions, and if met it send and Alert(). It is working well, but what I notice is that when I open up the terminal for the first time each day, it sends through yesterdays alerts as well as today's alerts. It's as if the script loads, doesn't realise its a new day, sends the alerts, updates the time and now realises its a new day and then sends the new alerts. Any idea how I can fix this?
Much appreciated!
Richard