else CheckValueTime = iTime(NULL,TimeFrame,0);
I got this code from other forum and I have this code in my ea too.
And I got a different results between with and with out this code.
With this code it's can run optimization faster than without.
I am not sure with or without this code that make EA realistic.
Please anyone suggest to me or if anyone has a better like this code I would be appreciate.
That code means that any code that follows will only be executed if a new bar opens in the stipulated timeframe.
Obviously a lot quicker than when the full code executes every tick.
Thank you GumRai.
I got a best result in backtest but bad results in demo.
You make me understand my EA better.
Thank you again.
Many strategies, such as MA crosses or stochastic/RSI crossing certain levels are coded to only execute when a bar closes (ie new bar opens).
This is to avoid (what some people consider) false signals when a cross happens while the bar is still open, but crosses back before the bar has closed.
I wonder why "CheckValueTime" variable remember previous value instant of reset to zero when EA execute again.
I just declare in normal variable not global variable.