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.
New candle - MQL4 programming forum #3 2014.04.04
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
...
Can anybody help me? I'd appreciate it!
I am not sure that it will help but it was some fixing in the latest beta build of MT5 - read post #1

- 2020.07.14
- www.mql5.com
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.
New candle - MQL4 programming forum #3 2014.04.04
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
i really doubt that the conditions in your "if()" had not been met.

- 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've been struggling with something that seems pretty easy to solve, but I can't figure it out.
I wrote an algorithm that should print which signal was activated last: open_buy or open_sell (see code bellow).
Also, inside the OnInit function I printed "EA initialized!". So it should print something even if no signal is activated.
- OBS1: the following code was written within OnTick function;
- OBS2: nb.IsNewBar() is the class I downloaded in this link to check the openning of a new bar.
Here is a picture of the Journal tab when I try to run the code:
I also tried to used Comment() instead of Print(), and the Comment() works just fine.
Can anybody help me? I'd appreciate it!