
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
Currently, my EA opens several orders on the same candle. I think the material in this article would help me.
How do I implement it?
You can take the trade entry logic out of the OnTick() event and put it inside the OnNewBar() function. This way, it will only be executed when there is a new bar, no more entering several times on the same candle, because once it has been executed, it will only execute again on the next candle.
Good article.
Thanks!
Very very Nice thanks,
I was hoping for a MQL5 libraries function but it seems there is none? I have a modular trading lib and I ran into the issue where the signal module would set its IsNewBar flag and overrides the prevCandleTime and when TrailingSL module had to evaluate the same function it returned false because the prevCandleTime is same as current.
Yes I can store the result in a central flag and use it for all modules and I would not run onto this is HOWEVER the modules can run on different timeframes, hence this solution is sooo perfect thanks.
Hello, I am assuming that as soon as the Open() quote has arrived, it means a new bar has arrived. IMHO it is easier or am I missing something?
Imagine a situation when the opening price of a new bar is equal to the opening price of the previous bar.... There is a high probability to catch such a situation on small TFs.
I have no simpler method than this one.
Tracks the opening time of the current bar and compares them at each tick.