How does MT4 tester considers the spreads?

 

How does MT4 tester considers the spread? Say I've inserted a 2 pips spread in the tester - does it adds 2 pips to Bid rates? does it perform the test as if the spread is 0 and subtract the 2 pips value from the P&L?

TX  

 
adibi83:

How does MT4 tester considers the spread? Say I've inserted a 2 pips spread in the tester - does it adds 2 pips to Bid rates? does it perform the test as if the spread is 0 and subtract the 2 pips value from the P&L?

TX  

The 2 that you've added is points, not pips and its a fixed spread that will be applied to your test.

If you want to do some serious backtesting and optimization you should move to MT5.

 
Eleni Anna Branou:

The 2 that you've added is points, not pips and its a fixed spread that will be applied to your test.

If you want to do some serious backtesting and optimization you should move to MT5.

I use 20 points which are 2 pips

Also, I use TickStory for reliable testing in MT4 (don't want to migrate to mt5).

 
adibi83:

I use 20 points which are 2 pips

Also, I use TickStory for reliable testing in MT4 (don't want to migrate to mt5).

BTW, I use this code but get different results when I change the spread (GBP-USD):


ticket = OrderSend(Symbol(),OP_SELL,amount,Bid,slippage,Bid+0.0100,Bid-0.0100,NULL,ID1,0,CLR_NONE);  

And I use trailing SL like that:

tempTicket = OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss()-0.0002,OrderTakeProfit(),NULL,CLR_NONE);


Given these numbers and the fact I use only BID rates, I don't think a 0 or 1 or 2 pips spread should make any difference.

Don't you think so? 

 
adibi83:

How does MT4 tester considers the spread? Say I've inserted a 2 pips spread in the tester - does it adds 2 pips to Bid rates? does it perform the test as if the spread is 0 and subtract the 2 pips value from the P&L?

TX  

I think its from bid rates like the first thing you mentioned. Because increasing spread differ performance greatly.
 
adibi83: tempTicket = OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss()-0.0002,OrderTakeProfit(),NULL,CLR_NONE);
  1. OrderModify does not return a ticket.

  2. You can not use any Trade Functions until you first select an order.

  3. Your 0.0002 is two PIPs only on non-JPY pairs. Unless you manually adjust your SL/TP for each separate symbol, using Point means code breaks on 4 digit brokers, exotics (e.g. USDZAR where spread is over 500 points), and metals. Compute what a PIP is and use it, not points.
              How to manage JPY pairs with parameters? - MQL4 programming forum 2017.02.09
              Slippage defined in index points - Expert Advisors and Automated Trading - MQL5 programming forum 2018.01.15

Reason: