MQL5 and MetaEditor Compiler Bug may seriously mess up your code

Cong Hoa Cuong Nguyen  

I have been working on a simple EA, until I ran into some funny result.

I cannot explain it, then I realize that by commenting/uncommenting a single print line will dramatically change your result.

Definitely an alarming behavior.

If anyone has any insight regarding this behavior, please share. I would most definitely hate to have my code messed up due to a print command.



Alain Verleyen  
Coincidence. Your EA would give different results even without recompiling ?
Cong Hoa Cuong Nguyen  
Alain Verleyen:
Coincidence. Your EA would give different results even without recompiling ?

Of course not. I have to tried several times, several recompilation to boil down to the stupid Printf, and to record the video. Not sure what happened there, but definitely not normal.

Alain Verleyen  
Cong Hoa Cuong Nguyen:

Of course not. I have to tried several times, several recompilation to boil down to the stupid Printf, and to record the video. Not sure what happened there, but definitely not normal.

We have no idea about what you did or not.

Your report is useless without code to reproduce it.

Pak Hong Poon  

did you use current spread or variable spread for the backtest?

cause your market is moving, if you use current spread the backtest result would be different

Cong Hoa Cuong Nguyen  
Pak Hong Poon:

did you use current spread or variable spread for the backtest?

cause your market is moving, if you use current spread the backtest result would be different

I just the exact tick data from July 1 to Sep 30 of 2020.

Pak Hong Poon  
Cong Hoa Cuong Nguyen:

I just the exact tick data from July 1 to Sep 30 of 2020.

whether you use tick data or not is irrelevant to the spread you assign to the backtest

Alain Verleyen  
Pak Hong Poon:

did you use current spread or variable spread for the backtest?

cause your market is moving, if you use current spread the backtest result would be different

MT5 Strategy Tester is using historical spread, not any current spread.
Reason: