Metatrader 4 strategy tester does not deduct spread from results?

 

Hi all,


looking at the results from my backtesting, it seems that MT4 does not deduct the spread from the results. Can someone confirm this? That is, with 1 pip stoploss, the loss amount is always the same in the results regardless of the spread I simulate. That should not be the case.


Any help appreciated.

 

The spread does not affect the stop loss level.


In future please post in the correct section

I will move your topic to the MQL4 and Metatrader 4 section.

 
holistic: looking at the results from my backtesting, it seems that MT4 does not deduct the spread from the results. Can someone confirm this?
You buy at the Ask and sell at the Bid. There is nothing to deduct.
  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?

  2. Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger at a specific Bid price, add the average spread.
              MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25

  3. The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (control+O) → charts → Show ask line.)
    Most brokers with variable spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134.
 

Thank you all for the replies. I have to correct myself, I was refering to pending orders since it seems that the problem occurs only there. I'm also new to the topic, so I apologize if my questions seem stupid somehow ;).


To clarify: For example, I set a pending buy order at some price in EURUSD, lets say an ask price of 1.08015, with 1 pip TP (1.08016) and 1 pip SL (1.08014). My broker (activtrades) allows this. Then, as soon as the ask price hits 1.08015 my order is executed and as soon as the Bid price hits 1.08014 the order is closed. With a spread of 5 pips, I should have a loss of 6 pips, with a lotsize of 0.01, -0.06 in €. That should be correct.


However, when I use the strategy tester and create an EA that randomly opens buy pending orders in that manner, my loss is always -0.01, i.e. 1 pip, regardless of the spread.This just does not make any sense to me.


Now, when I do the same and just open buy orders, then the loss amount is correct and always -0.06 and never more. Here, the spread is taken into account but not with the pending orders!


I hope this became clear, I can provide more details if needed.


Thanks

 

You are not using 1 pip SL and TP, you are using 1 point and unless you are getting a zero spread, I don't see how that is possible.

Besides that, once again,

The spread does not affect the stop loss level.

 

My bad, I mean points of course.


Nevertheless, even when the stoploss level is not affected, my loss amount should always be the number of points of my stoploss + spread, -0.06 in the example above.  This is not the case in the strategy tester (but only with pending orders). Or I do not really understand what is going on.


Can you reproduce this?


See the attached picture. This is a strategy test on EURUSD with a spread of 100. As you can see the Ask and Bid lines are 100 points apart. But in the result tab, the loss is -0.01. This does not make any sense to me.



 

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
The idea of ​​automated trading is appealing by the fact that the trading robot can work non-stop for 24 hours a day, seven days a week. The robot does not get tired, doubtful or scared, it's is totally free from any psychological problems. It is sufficient enough to clearly formalize the trading rules and implement them in the algorithms, and...
Reason: