Replace OnTick for every minute (OnTimer...?)
Why not just code it to do the calculations at the open of a new M1 bar?
void OnTick() { static datetime bar_time=0; datetime this_bar_time=iTime(Symbol(),PERIOD_M1,0); if(bar_time!=this_bar_time) { bar_time=this_bar_time; // Calculate Buy or Sell Signal int signal=LongSignal()+ShortSignal(); processSignal(signal); } }
I don't know that you can get OnTimer to execute exactly at a bar close.
GumRai:
That sounds like an excellent idea, thanks GumRai I'll give it a try!
Why not just code it to do the calculations at the open of a new M1 bar?
I don't know that you can get OnTimer to execute exactly at a bar close.
markcornbill:
That sounds like an excellent idea, thanks GumRai I'll give it a try!
That works perfectly. thanks :-)
That sounds like an excellent idea, thanks GumRai I'll give it a try!
Hi Guys
I have an EA running but it is evaluating entry conditions every tick, and I simply want it to check only once per minute, preferably at the close of a 1 minute bar.
On reading through the guides I guess this can be done by using OnTimer in place of OnTick, but I'm a little stuck now.
Can anybody help please? Here is the code I need to replace:
Thanks in advance.