Trade slippage is the common enemy that erodes your strategy’s expectancy, and usually becomes more severe after going live.
This post will cover:
- Why slippage occurs
- 4 simple ways to minimize slippage
- 3 ways to simulate slippage while backtesting
Every trader has complained about slippage at some point. Like spread and commissions, it is sometimes an unavoidable cost of trading.
Nonetheless, minimizing slippage should be a goal of every trader. In addition, can we improve our backtest realism by simulating slippage?
Let’s discuss!
What’s Slippage, and Why Does It Happen?
Slippage is the difference between the expected price of a trade, and the actual price at which the trade is executed.
For example, if you place a market order at $100, but you actually get filled at $101, you’ve just experienced a $1 slippage.
In general, there are two causes of slippage:
1. Execution Delay
There is a small delay between the time your order is placed and the time it’s executed by the server. Even if it’s only a fraction of a second, the market price may have changed, or the spread may have widened.
2. Low Liquidity
When market liquidity is low, there may be insufficient buyers/sellers at your requested price.
Suppose you place a market order to buy two lots at $100. This will be executed at the lowest price offered by sellers. If there are ample lots on sale at $100, your order will be filled without slippage.
Otherwise, your order will move up to the next available price. This will occur repeatedly until your order is completely filled. Eventually you may have one lot filled at $101, and the other at $102, giving you a total slippage of $3.
Tips to Minimize Trade Slippage
Slippage is especially detrimental if you trade frequently or have a small expectancy.
Here are four tips to minimize slippage:
1. Avoid Illiquid Hours
The first hour after the New York close is typically the most illiquid period of the trading day.
Your risk of slippage increases dramatically within this period.
I previously measured the GBPCAD spread over a 24-hour period using my Spread Recorder algorithm. The drastic spread widening (20 pips!) shortly after New York’s close illustrates the thin liquidity during this period.
After 1 a.m., spreads fall below 5 pips and approach the 24-hour average. Preventing entries and exits during the illiquid 12-1 a.m. window is a good way to minimize slippage.
Some mean reversion strategies, like the so-called Asian scalpers, exploit the random noise during these illiquid market hours. These can work very well; just be wary that slippage can have a large impact.
2. Avoid Trading the News
In volatile fast-moving markets, prices are likely to change during your order’s execution delay. If your strategy trades through the news, or even trades off the news, some slippage is practically guaranteed.
A good time to observe this is during the monthly US Nonfarm Payroll report. Central bank announcements aside, this has consistently been the mother of all US economic releases.
The strong price action and tick volume indicate the vastly increased trading activity.
To mitigate this, you can:
- Add a live news filter that pauses trading before high impact news
- Add a time entry filter that prevents trading in a certain window (e.g. Friday mornings)
Whatever option you choose, ensure that you can replicate similar filtering conditions in your backtest.
3. Use Limit Orders
A limit order is only executed at the price you specify, or better.
A buy limit is placed below the current market price, while a sell limit is placed above the current price.
Unlike market orders and stop orders, limit orders won’t fill at a worse price. Any stop or market order that you can replace with a limit order will reduce slippage.
Be careful about using limit orders for your stop loss. If you need to exit the market in a hurry, the immediate execution of a market order will be handy.
Limit orders have their own drawbacks, however.
Firstly, the market may never reach your limit price, so you may miss the trade entirely. And even if your limit price is hit, chances are you’ll only get a complete fill if the market penetrates (not just touches) your price.
The second problem is ‘phantom’ backtest fills.
These ‘phantom’ fills occur because conventional backtest engines assume a limit order will be completely filled when the price is hit. If the market bounces off your buy limit and rallies to profit, your backtest will register a full winning trade. In live trading, the trade could have been a partial fill, or even missed.
This creates an optimistic backtest with many winning trades that can’t be replicated in reality.
Changing your order type should only be a means of fine-tuning your strategy; your overall trading idea should take priority.
For example, I generally find that stop entries work better than limit entries for trend following strategies. I’m not going to use a limit entry simply because of slippage.
4. Use a Forex VPS
A virtual private server (VPS) is a computer that you can access remotely and house your MT4 platforms on.
Selecting a forex VPS that is located close to your broker’s servers will minimize latency and keep slippage low. The chart below shows the latency in milliseconds between FXVM’s New York server and several prominent brokers.
If you’re a scalper and every pip is critical, renting a VPS is highly recommended.
I run all my live and incubation portfolios on my FXVM VPS. Although slippage is rarely a problem for me, the added reliability of a VPS is priceless.
Click the banner below to check out FXVM’s plans.
Simulating Trade Slippage in Your Backtests
I’m a firm believer in backtesting. Your backtest displays your strategy’s historical profitability, and helps you establish performance expectations for live trading.
For a realistic backtest, all transaction costs (including slippage) need to be included.
You don’t want inflated performance metrics that cannot be replicated in live trading. In addition, when optimizing your strategy, excluding slippage usually creates a bias towards parameters that increase trading frequency. This creates a double whammy because the more you trade, the more you lose to slippage.
Now let’s discuss several ways to include slippage in your backtests.
1. Adding a Constant Slippage per Trade
StrategyQuant’s backtest engine lets you separately specify each type of transaction cost, including slippage.
The slippage specified here (1 pip in the image above) will be applied to every market order in your strategy.
This includes stop orders, since they are converted to market orders when the stop price is hit.
So for example, if you enter the market on a buy stop, and exit using a stop loss, the backtest engine will register a 2-pip slippage.
If you instead enter on a limit order, and exit on a profit target, you will not have any slippage.
To illustrate the effects of slippage, I’ll use a GBPNZD scalping strategy for the rest of this article. Here’s how it backtests with a 2-pip spread and no slippage.
After adding a constant slippage per trade, here’s how the equity curves compare.
Even a modest 2-pip slippage is enough to halve the strategy’s profit.
So how much slippage should you specify per trade? This depends on your strategy and market. Here are some factors to consider:
- Are you trading a thin market? (e.g. emerging market currencies)
- Are you mainly using market orders?
- Do you often trade during periods of high volatility and/or low liquidity?
If many of the above apply to you, a larger slippage is warranted. It’s better to be conservative during your development than be disappointed during live trading.
You can refer to the Analysis tab to find out your strategy’s typical trading days and hours.
If you use MT4 for backtesting, you won’t be able to directly specify slippage. You can increase your spread to reflect higher transaction costs, but you won’t be able to specifically target your strategy’s market orders.
2. Randomizing Spread Using Monte Carlo Simulations
Monte Carlo simulations use repeated random sampling to provide a probabilistic assessment of strategy performance.
In this case, this involves running 1000 separate backtest runs, each using a random slippage within the 0.5-3.0 pip range.
Let’s set up StrategyQuant’s Monte Carlo simulator.
And here is the collection of simulated equity curves:
The original equity curve, which has zero slippage, is outlined in blue. Since all 1000 simulations have slippage applied, they perform poorer than the original.
There is still a $5700 profit at the 95% confidence level. This means that of the 1000 simulations, only 50 produce a profit worse than $5700.
This is an acceptable result to me. Once again, the strictness of your passing criteria will depend on your strategy and market.
3. Adding an Execution Delay to Each Trade
Rather than directly specifying the slippage in pips, you can also introduce an execution delay to each trade.
Birt’s Tick Data Suite, which is known to be the gold standard in MT4 tick-precision backtesting, offers such a capability.
Adding an execution delay lets you simulate slippage as it occurs when using an ECN broker. Your backtest orders will be executed at the current price after addition of the delay.
Wrapping Up
Accounting for trade slippage during strategy development is essential if you trade frequently or have a small expectancy.
Minimizing slippage using the tips above, and subsequently including slippage in your backtests, will help avoid unpleasant surprises while trading live.
Nonetheless, if you suspect your strategy is very prone to slippage, testing it on a small live account is recommended. This is the most accurate way to study the effects of market liquidity.
To do the backtests and Monte Carlo simulations above, don’t forget to make use of StrategyQuant’s 14-day Free Trial!
Thank you for your feedback. Here are the improved versions of your sentences:
It would be beneficial if StrategyQuant could incorporate the feature of “Adding an Execution Delay to Each Trade.” Do you have any insights on how this is implemented in Birt’s Tick Data Suite?
Additionally, you did not mention the potential for positive slippage, which could result in obtaining a more favorable price, leading to larger profits and smaller losses. Could you provide some information on this aspect?
I understand that you primarily trade forex. However, I would appreciate any advice or suggestions on studying slippage in gold for beginners. Gold tends to have relatively significant slippage, so how can a beginner reasonably estimate and simulate the slippage in Monte Carlo simulations using StrategyQuant?