Slippage when backtesting a strategy?

 

Hi,

I have been programming in MT4 for a couple of months now so forgive my silly question.

when I test a strategy I notice that occasionally there is a slippage when opening some positions (long or short)

and they coincidentally are equal to the current spread I set in the tester.

I know the difference between spread (the difference between ask and bid expressed in points) and slippage (that depends on the speed and can happen on instant execution and blah blah...)

My question is why does the slippage happen only on certain positions? and why slippage is equal to spread?


Thanks


Raimondo

 
Raimondo Marino:

Hi,

I have been programming in MT4 for a couple of months now so forgive my silly question.

when I test a strategy I notice that occasionally there is a slippage when opening some positions (long or short)

and they coincidentally are equal to the current spread I set in the tester.

I know the difference between spread (the difference between ask and bid expressed in points) and slippage (that depends on the speed and can happen on instant execution and blah blah...)

My question is why does the slippage happen only on certain positions? and why slippage is equal to spread?


Thanks


Raimondo

There's MT4 extension that add slippage to testing. 

Regarding the issue you're facing, and considering the fact MT4's tester doesn't support execution delay, it should be due to a code inconsistency. 

 
Icham Aidibe:

There's MT4 extension that add slippage to testing. 

Regarding the issue you're facing, and considering the fact MT4's tester doesn't support execution delay, it should be due to a code inconsistency. 

Thank for your reply

I actually found the source of my mistake.

The slippage is found only in long positions (I made a mistake in my previous mail) that's because you buy at ASK price that is higher (by the spread difference) than the BID price. On charts only BID prices are generally shown (unless you specify differently)

that's the reason why there is this false slippage. (Actually this is the spread between BID and ASK).  If I set the spread to the minimum I don't have this issue.

Are you sure that there is slippage in the tester?

In my tester there is no slippage.

tks again

 
Raimondo Marino:

Thank for your reply

I actually found the source of my mistake.

The slippage is found only in long positions (I made a mistake in my previous mail) that's because you buy at ASK price that is higher (by the spread difference) than the BID price. On charts only BID prices are generally shown (unless you specify differently)

that's the reason why there is this false slippage. (Actually this is the spread between BID and ASK).  If I set the spread to the minimum I don't have this issue.

Are you sure that there is slippage in the tester?

In my tester there is no slippage.

tks again

Icham Aidibe:

There's MT4 extension that add slippage to testing. 

Regarding the issue you're facing, and considering the fact MT4's tester doesn't support execution delay, it should be due to a code inconsistency. 

There's an addon for MT4 adding various slippage to testing, I've seen it somewhere, it's a data downloader but I don't know more about as I use MT5 (for which I hope such an option could be one day added by the way).

Reason: