I'm building an EA that must place a trade at the beginning of a new bar. Regarding to less time delay from the opening time of the new bar, which one is more recommended to use: OnTick() or OnTimer()?
Yes, usually. However, each bar can only have 1 first tick
The open time of a bar is stored in a static/globalscope variable.
At each tick the open time of the current bar is compared to the value. If it is not the same, then it must be the first tick of a new bar (received by the Expert)
The variable is reassigned the value of the current bar's open time in order to check for the next new bar.
Strange that you quote my post which has already answered your question
If it is not the same, then it must be the first tick of a new bar (received by the Expert)
It follows that if it IS the same, it must be a subsequent tick
To add comments, please log in or register