Slippage Simulation


#1

How do you simulate/backtest slippage in Amibroker realistically?


#2

You can use BuyPrice, SellPrice, ShortPrice and CoverPrice to simulate slippage or spread.


#3

The reason I am asking about spread and slippage is because I have a system on a 15 minute timeframe, which day-trades (closes all positions at market on close) on Open prices (BUY/SELL signals) and sets these prices as limit orders and has stops as well. For MDY for example, from 2015 until today, the system trades 4827 times with 30% winners and 70% losers. It generates a return of 50% with a max draw down of only 5%.

However, based on my experience with the live market, I cannot expect that limit orders with Open prices get filled and it's not really possible to know the BID/ASK prices here. The spread is essential for MDY as currently for example it has a BID of 355.99 and ASK of 356.06 so a spread of Open x (1 +- 0.0002). Once I add this spread to all my Open prices for BUY/SELL events, the system generates a return of -60% instead.

As you can see, the spread has a huge impact on my system's performance and the issue is that it is impossible to know if historical prices were BID/ASK prices at all. Not sure what can be done about this really.

I think it is also wrong to expect that all BUY/SELL orders will have a spread added/subtracted to the historical prices (backtesting only worst possible scenarios), but this does not sound realistic.

Really struggling with this as without figuring out how to simulate and apply spread, it is impossible to backtest intraday systems with reliable results at all... What is the use of intraday bars then for backtesting if we have no bid/ask data at least at Open/Close of bars?


#4

@trongart If I may make a suggestion, you need to read more about trading systems. In particular you should become familiar with "Expectancy", and the effect of slippage and commissions on a strategy with a very very low expectancy.

Although you haven't presented all of the details of your results, you have written that it took 4827 trades to make a 50% return. It appears that is before you have factored in slippage and commissions on those 4827 trades.

I can guesstimate that your Expectancy is around 0.01% per trade and that will surely get eliminated by any realistic estimate of slippage and commissions.

So yes you are correct to want to become familiar with slippage but there appears to be a lot more you need to become familiar with.

With regards to AmiBroker you can look here for some interesting info,

And a worthwhile read,