Historical Data do not match the ones received in Strategy Tester

 

Hello, the screenshot shows historical data (right hand side) for Disney Stock exported from MT5. For the date 08.11.2016 17:17:00 - 17:17:59 there are a lot of ticks (BID,ASK,LAST) available.

If you compare it to the print out of the Strategy Tester (left hand side) one sees that only some of the BID and ASK prices can be found in the exported historical data. Also the seconds do not match.

And for the entire day, I do not receive any LAST prices at all, even they are there in the historical data.

I know that the print out is too slow so that not all data are printed but the ones printed do not match as shown...

Any ideas?

void OnTick()
{  if(TimeCurrent()>=D'2016.11.08 00:00:00')
      {  Print("Time TS: ", TimeTradeServer());
         Print("Time TC: ", TimeCurrent());
         Print("LAST: ", SymbolInfoDouble(_Symbol,SYMBOL_LAST));
         Print("BID: ", SymbolInfoDouble(_Symbol,SYMBOL_BID));
         Print("ASK: ", SymbolInfoDouble(_Symbol,SYMBOL_ASK));
      }     
}

Data Comparison 

 
ammer.jens:Hello, the screenshot shows historical data (right hand side) for Disney Stock exported from MT5. For the date 08.11.2016 17:17:00 - 17:17:59 there are a lot of ticks (BID,ASK,LAST) available. If you compare it to the print out of the Strategy Tester (left hand side) one sees that only some of the BID and ASK prices can be found in the exported historical data. Also the seconds do not match. And for the entire day, I do not receive any LAST prices at all, even they are there in the historical data.I know that the print out is too slow so that not all data are printed but the ones printed do not match as shown... Any ideas?

 

Are you testing with modelling set to "Every tick" or "Every tick based on real ticks"?

If you are using "Every tick" then they will not match as that is a virtual tick modelling, so use the "Every tick based on real ticks" instead.


 

Hi Fernando! I use "Every tick based on real ticks" that is why I was wondering about the difference...

I also use random delay but I don't think that's the reason for the difference

Settings

 
ammer.jens #: Hi Fernando! I use "Every tick based on real ticks" that is why I was wondering about the difference... I also use random delay but I don't think that's the reason for the difference
Have you tried to first test without a delay before considering your query?
 
Hi Fernando, I did not but I tested it just now and it is the same for no latency or any other latency. The reason I did not consider it is that I get a LAST price of 0 for a couple of days before it gets back to "normal behaviour". But even with no latency for some reason I do not receive a last price for the same amount of days
 
ammer.jens #: Hi Fernando, I did not but I tested it just now and it is the same for no latency or any other latency. The reason I did not consider it is that I get a LAST price of 0 for a couple of days before it gets back to "normal behaviour". But even with no latency for some reason I do not receive a last price for the same amount of days
Instead of using "SymbolInfoDouble(_Symbol,SYMBOL_LAST)" etc., I suggest you use the SymbolInfoTick() function to get all the data in single operation instead, just in case your data is being updated between operations, as there could be delays between retrieving data individually line by line as is the case in your source code.
 

Good morning Fernando,

I added time, bid, ask and last via SymbolInfoTick() and both ways give the exact same values and thus there is no last price either...

void OnTick()
{
   MqlTick t;

   if(TimeCurrent()>=D'2016.11.08 00:00:00')
   {  if(SymbolInfoTick(Symbol(),t))
      {  Print("Time TS: ", TimeTradeServer(), " Time MT: ", t.time);
         Print("LAST: ", SymbolInfoDouble(_Symbol,SYMBOL_LAST), " LAST MT: ", t.last);
         Print("BID: ", SymbolInfoDouble(_Symbol,SYMBOL_BID), " LAST MT: ", t.bid);
         Print("ASK: ", SymbolInfoDouble(_Symbol,SYMBOL_ASK), " LAST MT: ", t.ask);
      }
      else Print("SymbolInfoTick() failed, error = ",GetLastError());
   }
}

Values

I also installed a new instance of MT5 just in case something is broken but I see the same behaviour on the newly installed MT5. I tested different latencies again but no luck. 

Any further ideas? Thank you!

 
ammer.jens #: Good morning Fernando, I added time, bid, ask and last via SymbolInfoTick() and both ways give the exact same values and thus there is no last price either... I also installed a new instance of MT5 just in case something is broken but I see the same behaviour on the newly installed MT5. I tested different latencies again but no luck. Any further ideas? Thank you!

The only thing I can say is that you have shown a comparison with an Excel sheet, and that in itself is not very "trustworthy" as proof.

Instead show us the screenshot of the actual tick data returned by the Symbols properties panel instead, like so ...


 

Hi Fernando, sorry for late reply but was busy with my actual work...

As you can see from the two screenshots, for the two times 2016.11.08 14:35:11 and 2016.11.08 14:35:06 there are LAST prices available but the Strategy Tester receives "0" for the LAST prices. Furthermore, the BID and ASK prices do not match either.

Ticks Ticks Strategy Tester

 
To me it looks as if Bid & Ask are provided by the broker if there are new pending orders (I'd like to buy/sell at..) and Last only if a real transaction took place at the previously shown Bid or Ask.
 
Hi Carl, as additional information - as already stated above - I don't get LAST prices for a consecutive of 5 days from the 2016.11.08 to the 2016.11.14 and for the 2016.11.09 I do not receive any values (last, bid, ask) at all even though there are thousands of ticks available... In the chart, the bars are drawn for all of those days including the 11.09.