One trade per bar...

 

Is there a simple way to get an EA to only open one trade per bar?


I keep coming across looping problems, especially when I open a trade based on the current ask (rather than a candle close). If the exit conditions occur in the same bar it will open and close continuously.


I would like to know if anyone has a simple solution to this problem...

 
rogue1:

Is there a simple way to get an EA to only open one trade per bar?


I keep coming across looping problems, especially when I open a trade based on the current ask (rather than a candle close). If the exit conditions occur in the same bar it will open and close continuously.


I would like to know if anyone has a simple solution to this problem...

I found a good solution for you - https://www.mql5.com/en/forum/5762/page3#comment_13056672

How to detect a new bar
How to detect a new bar
  • 2017.07.16
  • www.mql5.com
Hi All, I'm a complete newbie to MQL5 but I've done a fair bit of coding for other platforms...
 
Kenneth Parling:

I found a good solution for you - https://www.mql5.com/en/forum/5762/page3#comment_13056672

Thank you...
Reason: