MT4 Strategy Testing Bar values dont match

 

Hi All,


I am new in MQL4 and I am trying to understand the strategy testing of MT4. When I try to run my EA, the Open/Close values does not match what is on the chart and it is way off:


2021.07.19 00:09:02.182 2020.07.16 00:00:00  DoyEA AUDCHF,Daily: Executed: 2020.07.16 00:00:00 Prev Close:0.66169 Close: 0.66169 Prev Open: 0.65533 Time:2020.07.15 00:00:00

2021.07.19 00:09:02.182 2020.07.15 00:00:00  DoyEA AUDCHF,Daily: Executed: 2020.07.15 00:00:00 Prev Close:0.65554 Close: 0.65554 Prev Open: 0.65335 Time:2020.07.14 00:00:00

2021.07.19 00:09:02.182 2020.07.14 00:00:00  DoyEA AUDCHF,Daily: Executed: 2020.07.14 00:00:00 Prev Close:0.65335 Close: 0.65335 Prev Open: 0.65304 Time:2020.07.13 00:00:00


I am currently just printing out to validate the values when running the EA. My source code is as follows:


void OnTick()
  {
//---
   static datetime curtime = 0;
   
   if (curtime != Time[0]) {
      curtime = Time[0];
      Print("Executed: ", curtime, " Prev Close:", iClose(NULL, PERIOD_D1, 1) , " Close: ", Close[1], " Prev Open: ", Open[1], " Time:", Time[1]);
   }
   else
    return;
   
   
  }
 
Doy Roberto:

Hi All,


I am new in MQL4 and I am trying to understand the strategy testing of MT4. When I try to run my EA, the Open/Close values does not match what is on the chart and it is way off:


2021.07.19 00:09:02.182 2020.07.16 00:00:00  DoyEA AUDCHF,Daily: Executed: 2020.07.16 00:00:00 Prev Close:0.66169 Close: 0.66169 Prev Open: 0.65533 Time:2020.07.15 00:00:00

2021.07.19 00:09:02.182 2020.07.15 00:00:00  DoyEA AUDCHF,Daily: Executed: 2020.07.15 00:00:00 Prev Close:0.65554 Close: 0.65554 Prev Open: 0.65335 Time:2020.07.14 00:00:00

2021.07.19 00:09:02.182 2020.07.14 00:00:00  DoyEA AUDCHF,Daily: Executed: 2020.07.14 00:00:00 Prev Close:0.65335 Close: 0.65335 Prev Open: 0.65304 Time:2020.07.13 00:00:00


I am currently just printing out to validate the values when running the EA. My source code is as follows:


The testing date is on 2020 while the screenshot date is 2021 .

 
Doy Roberto:

Hi All,


I am new in MQL4 and I am trying to understand the strategy testing of MT4. When I try to run my EA, the Open/Close values does not match what is on the chart and it is way off:


2021.07.19 00:09:02.182 2020.07.16 00:00:00  DoyEA AUDCHF,Daily: Executed: 2020.07.16 00:00:00 Prev Close:0.66169 Close: 0.66169 Prev Open: 0.65533 Time:2020.07.15 00:00:00

2021.07.19 00:09:02.182 2020.07.15 00:00:00  DoyEA AUDCHF,Daily: Executed: 2020.07.15 00:00:00 Prev Close:0.65554 Close: 0.65554 Prev Open: 0.65335 Time:2020.07.14 00:00:00

2021.07.19 00:09:02.182 2020.07.14 00:00:00  DoyEA AUDCHF,Daily: Executed: 2020.07.14 00:00:00 Prev Close:0.65335 Close: 0.65335 Prev Open: 0.65304 Time:2020.07.13 00:00:00


I am currently just printing out to validate the values when running the EA. My source code is as follows:


The Attached picture show candles of 17/06/2021 (as can be seen on the information box on the left of the picture)


The LOG you posted is from 19/07/2021 and contais data from 14/07/20 to 16/07/20


You are comparing a picture with data information from JUNE (month number 06) to a log with data information from JULY (month number 07)

Check the year too


They will not match, for sure. :)

 
rrocchi:

The Attached picture show candles of 17/06/2021 (as can be seen on the information box on the left of the picture)


The LOG you posted is from 19/07/2021 and contais data from 14/07/20 to 16/07/20


You are comparing a picture with data information from JUNE (month number 06) to a log with data information from JULY (month number 07)

Check the year too


They will not match, for sure. :)


Lorentzos Roussos:

The testing date is on 2020 while the screenshot date is 2021 .



Holy crap. Good catch guys. It was very late here already and maybe sleepiness got to me. I corrected the dates in the testing it looks to be matching now. Thanks!

Reason: