
- www.mql5.com
Makes no sense. The current bar is never closed; that is why it is called current.
Stop looking at the current bar.
Stop looping; A cross in the past is irrelevant.
Look for your cross on the start of a new bar.
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
MT4: New candle - MQL4 programming forum #3 (2014)
MT5: Accessing variables - MQL4 programming forum #3 (2022)
I disagree with making a new bar function, because it can only be called once per tick (second call returns false). A variable can be tested multiple times.
Running EA once at the start of each bar - MQL4 programming forum (2011)
Makes no sense. The current bar is never closed; that is why it is called current.
Stop looking at the current bar.
Stop looping; A cross in the past is irrelevant.
Look for your cross on the start of a new bar.
thanks William, i did as you advised, and its working fine.
Makes no sense. The current bar is never closed; that is why it is called current.
Stop looking at the current bar.
Stop looping; A cross in the past is irrelevant.
Look for your cross on the start of a new bar.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I created an EA, during the backtest i found out that the Ea opens position when an arrow signal flashes (the arrow does not repaint but sometimes flashes, it is after the close of the current candle stick that the arrow will stay or not, but ones it stays it does not repaint), where i need help is on lines to add so the EA does not close position unless the arrow stays on the current bar after close.
here is the code