journal tab is empty even though I print text to it

 

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.


   //--- CONDITIONS FOR OPENNING A POSITION
   bool open_buy   = (MA_9[2] < MA_21[2]) && (MA_9[1] > MA_21[1]);
   bool open_sell  = (MA_9[2] > MA_21[2]) && (MA_9[1] < MA_21[1]);
   
   //--- DEBUGGING OPEN / CLOSE SIGNALS
   if ( open_buy && (PositionsTotal()==0) && (nb.IsNewBar(_Symbol,_Period)) )
      Print("Last activated signal = OPEN_BUY");
   if ( open_sell && (PositionsTotal()==0) && (nb.IsNewBar(_Symbol,_Period)) )
      Print("Last activated signal = OPEN_SELL");


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!

 

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.

 
Duan Cleypaul:
...

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 

the Log message has output nothing after today's Update(build 2532), what happen?
the Log message has output nothing after today's Update(build 2532), what happen?
  • 2020.07.14
  • www.mql5.com
the Log message has nothing now, no open/close position message, no Print("...") function's output, just several lines like this: 2020.07...
 
i really doubt that the conditions in your "if()" had not been met.
 
William Roeder:

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.

That wasn't the main issue in my question, but I appreciate the heads up. I'll definitely take a look into that. Thanks a lot!
 
Sergey Golubev:

I am not sure that it will help but it was some fixing in the latest beta build of MT5 - read post #1 W

Wow! Thank you so much! That was the exact problem! I just downloaded again the .exe and reinstalled it. Problem solved! 


Thank you, thank you, thank you! \o/

 
lissp:
i really doubt that the conditions in your "if()" had not been met.
That wasn't the main issue in my question, but I appreciate the heads up! I'll take a look into that and try to improve the logic.
Reason: