Trade Slippage: How Can You Simulate and Minimize It?

Oct 15, 2021

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!

Powered By

Development Platform

Forex VPS

FXVM Forex VPS

Popular Posts

Laguerre RSI Trend Following Strategy

The Laguerre RSI attempts to improve the responsiveness of the regular RSI, whilst keeping whipsaw trades to a minimum. Let’s see how well it detects short-term pullbacks for a trend following strategy!

read more

What is Fixed Ratio Money Management?

Have you heard of fixed ratio money management? How does it compare to the popular fixed fractional approach? Here I’ll explain how fixed ratio works, and see how it stacks up against fixed fractional money management.

read more

Build a Diversified Portfolio With QuantAnalyzer

The ability to efficiently trade a diversified portfolio of strategies is one of the biggest advantages of algorithmic trading. Here we will use QuantAnalyzer’s Portfolio Master to build a portfolio consisting of high performing, uncorrelated strategies.

read more

What Is the QQE Indicator?

The QQE is a mysterious indicator that sometimes pops up in trading forums. Does it deserve a place alongside the more traditional momentum indicators like the RSI and CCI? Let’s add it to a trend following strategy to find out!

read more

Make your money work for you!

Get promotions, trading ideas and strategy development tips delivered to your inbox!

Comments

1 Comment

  1. Mike

    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?

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Trading Strategies

What’s the Best Time to Trade Forex?

What’s the Best Time to Trade Forex?

The forex markets are open 24/5, but not all hours are created equal. Here I dissect my broker data to determine the best time to trade forex.

Forex Weekend Gaps: Can You Exploit Them?

Forex Weekend Gaps: Can You Exploit Them?

Have you noticed that forex weekend gaps usually reverse within 3 days? Here I’ll program a mean reversion strategy to exploit gaps over the last 18 years!

Money Flow Index: An Improved RSI?

Money Flow Index: An Improved RSI?

The Money Flow Index is sometimes called the volume-weighted RSI. Can it outperform the RSI in this trend following strategy?

Automated Bollinger Bands Squeeze Forex Strategy

Automated Bollinger Bands Squeeze Forex Strategy

StrategyQuant’s BBWR indicator is the perfect tool to detect a Bollinger Bands squeeze. Here I explain how it’s calculated, and use it to program a breakout strategy for the AUDJPY!

Should You Use the Kelly Criterion for Forex Trading?

Should You Use the Kelly Criterion for Forex Trading?

The Kelly criterion is a famous mathematical formula that attempts to maximize your long-term capital growth. In this post, I’ll apply it to a EURUSD breakout strategy and explain some of its potential shortcomings when applied to forex trading.

Can a Trading Pause Improve Your Trend Following Results?

Can a Trading Pause Improve Your Trend Following Results?

A temporary trading pause can improve your win rate if you’re trend following a volatile market. Here I’ll program a trading pause into a simple breakout strategy, and test its effectiveness on the Widow Maker – the GBPJPY.

Laguerre RSI Trend Following Strategy

Laguerre RSI Trend Following Strategy

The Laguerre RSI attempts to improve the responsiveness of the regular RSI, whilst keeping whipsaw trades to a minimum. Let’s see how well it detects short-term pullbacks for a trend following strategy!

How to Use the Supertrend Indicator

How to Use the Supertrend Indicator

Despite its cool name, the Supertrend indicator often seems to slip under the radar. Here I explain how it’s calculated, and combine it with moving averages to produce a simple trend following strategy.

Strategy Development

Do You Know Your System Quality Number?

Do You Know Your System Quality Number?

The System Quality Number measures the profitability & consistency of your trading system. Here’s how to calculate your SQN and use it to improve your trading!

How to Get a Realistic Backtest Spread

How to Get a Realistic Backtest Spread

Your choice of backtest spread can certainly make or break a strategy. This post will show you how to study the intraday spread variations of your market, and suggest several ways to avoid paying ridiculous spreads.

Do You Know Your Strategy’s Optimization Profile?

Do You Know Your Strategy’s Optimization Profile?

Your strategy’s optimization profile often reveals its robustness, helping you select strategies that will remain profitable in live trading. Here I explain why an optimization profile is important, and how you can easily obtain one using StrategyQuant’s optimizer.

Which MT4 Backtest Report Metrics Should You Use?

Which MT4 Backtest Report Metrics Should You Use?

Understanding your backtest report is an essential part of being a successful strategy developer. Here I explain what the numbers mean, and how you can make use of each metric during strategy development.

Out-of-sample Testing Using Monte Carlo Simulations

Out-of-sample Testing Using Monte Carlo Simulations

Traders often use Monte Carlo simulations to estimate worst-case drawdowns, but did you know they can be used for out-of-sample testing too? This post demonstrates the use of StrategyQuant’s Monte Carlo simulator to randomize historical prices and strategy parameters, helping you select robust strategies for live trading.

How Many Trades Should Your Backtest Have?

How Many Trades Should Your Backtest Have?

We all want a large sample of trades in our backtests, but practical limitations such as data availability often get in the way. Here I’ll explain why 30 trades is insufficient, and how you can use standard error to quantify the uncertainty arising from a small sample size.

Build a Diversified Portfolio With QuantAnalyzer

Build a Diversified Portfolio With QuantAnalyzer

The ability to efficiently trade a diversified portfolio of strategies is one of the biggest advantages of algorithmic trading. Here we will use QuantAnalyzer’s Portfolio Master to build a portfolio consisting of high performing, uncorrelated strategies.

Strategy Optimization Using MT4

Strategy Optimization Using MT4

How do you improve your trading strategy in MT4? This post will show you how to optimize the entry and exit parameters for a moving average crossover strategy. Finally, an intraday time filter will be added to help avoid false breakouts.

Debugging & Backtesting Using MT4

Debugging & Backtesting Using MT4

With a fresh algorithm at your fingertips, how do you verify that it has been programmed correctly? This guide will show you how to use Metatrader 4’s visual backtester to debug and backtest your strategy.

Create Your Trading Algorithm in 15 Minutes (FREE)

Create Your Trading Algorithm in 15 Minutes (FREE)

Converting your trading idea into an algorithm is the first step towards reaping the benefits of automated trading. This guide will cover the creation of a simple moving average crossover algorithm, without any actual programming.

What Is Drawdown in Trading?

What Is Drawdown in Trading?

Are you getting a comprehensive assessment of your strategy’s downside? This post will discuss several methods to measure drawdowns, helping you build and select strategies that better suit your risk appetite.

How to Select the Best Trading Strategy Entry

How to Select the Best Trading Strategy Entry

With an abundance of technical indicators available, selecting your strategy’s entry conditions can be overwhelming. This post will illustrate a method to graphically compare the profitability of different entries.

Live Trading

What’s the Best Time to Trade Forex?

What’s the Best Time to Trade Forex?

The forex markets are open 24/5, but not all hours are created equal. Here I dissect my broker data to determine the best time to trade forex.

How to Find a Real Trading Guru

How to Find a Real Trading Guru

Every day I come across a trading guru offering educational content on the internet. Many of them speak of huge returns with minimal effort. Should these be trusted? Here’s some tips on how to separate the wheat from the chaff.

How to Enjoy Stress-Free Trading

How to Enjoy Stress-Free Trading

Trading is a great way to make some additional income, but not if you’re constantly pulling your hair out. Here I offer 7 tips to help make your trading profitable and stress-free.

How to Select the Best Forex VPS

How to Select the Best Forex VPS

A virtual private server (VPS) is a virtual computer that you can rent and access remotely. It provides a reliable platform on which to execute your forex strategies. This post will help you decide whether you need a VPS, and show you how to select an optimal VPS.

Make your money work for you!

Make your money work for you!

 

Get trading ideas and strategy development tips delivered to your inbox!

Thanks for subscribing!

Pin It on Pinterest

Share This