target reached on same candle with mt4, next candle with mt5 (same history tick data)

 

hi, 

please, could you help me ?

i wrote a smple EA :    if  ( open - Ask ) > x          then    buy at market, stop and target 10 pts.

on mt4, target is reached on current candle, and with mt5 target is reached on next candle.

On attached file, you can see (history tick snapshot)  that target price can be reached on current candle with mt5 but it waits next candle.

I do not understand why.

Regards,

Files:
Capture1.JPG  77 kb
Capture2.JPG  112 kb
Capture3.JPG  142 kb
Capture4.JPG  193 kb
Capture5.JPG  103 kb
Capture6.JPG  105 kb
Capture7.JPG  138 kb
 
What build ? What testing mode ?
 
  1. Don't post pictures of code, they are too hard to read. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2. Frédéric LEBRE: that target price can be reached on current candle with mt5 but it waits next candle. I do not understand why.
    You are using the tester. Unless you have history for all lower TFs for MT4 and no "unmatched data errors," the generated price movement might be off compared to MT5. MT5 only uses the M1 but that still means market might not have reached your TP until the second candle.
  3. Was the spread used the same? You buy at the Ask and sell at the Bid.
    1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?

 
William Roeder:
  1. Don't post pictures of code, they are too hard to read. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

  2. You are using the tester. Unless you have history for all lower TFs for MT4 and no "unmatched data errors," the generated price movement might be off compared to MT5. MT5 only uses the M1 but that still means market might not have reached your TP until the second candle.
  3. Was the spread used the same? You buy at the Ask and sell at the Bid.
    1. Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?

Hi, sorry for code snapshots, i did not know.

in mt4 i use tick data with set spread to 10. in mt5 i imported csv tick data from same source with 10 between bid and ask.

SO i have same bid and same spread.

if you see attached files, on picture 6 you see that price can be reached on MT5 current candle.

 

I have finally found. on my red candle, the order opens between the close and the low. If the target is lower than the close, it closes on the current candle and  if the target is located higher than the close, it closes on the next candle.

As the candle is red, it considers that it may not touch the target.

Therefore this is not of tick by tick backtest, but only OHLC.

Is it possible to make the true tick by tick with MT5 as with MT4?