Back

Does slippage really matter?

I have been in turmoil in trying to combat slippage lately. I have been tinkering with some mean reversion equity strategies that make high frequency trades. The more short term and lower price the security, the better they seem to perform. The real problem I've found is that it seems like the difference between the ask and bid at any given buy and sell for a transaction is greater than the difference between the close of the given buy and sell; meaning the profit margins are negative even though it was a winning sell; It's so hard to tell. So you can see I've developed a healthy fear for slippage.

I've been incorporating a slippage estimation function for each buy and sell based off the following formula I adapted from a forum post I lost reference to. I know a more accurate formula could be derived with the ask & bid prices, but alas, I don't have reasonable effort access to them.

if (this.ClosePrice < this.OpenPrice)
{
potentialSlippage = this.LowPrice - this.OpenPrice;
}
else
{
potentialSlippage = this.HighPrice - this.OpenPrice;
}


When incorporating this into my algorithm the results are rather depressing and is always a net loss. It's been a futile uphill battle of optimization to break even.

But one thing though I've come across time and time again when researching the matter is negative slippage vs positive slippage. So my question is, do you suppose I could assume maybe that if negative and positive slippage occurs about 50/50, that really it sort of evens out in the end and that I don't even need to worry about it? If that is remotely possible I understand it would be subject to volume and various other factors, but I'm talking generally even out. My function always assumes extreme negative slippage and it just doesn't work.

Also, have any of you who have even ran live with a high frequency algorithm ever have issues with slippage or does it even out for you?

I did find the following snippet from a forex post, but it sounds promising. Not sure if this applies to equity trading though:

Since it is market order, mean slippage per trade will be very little, as over time positive slippage will balance out with negative slippage. For me, i get a mean slippage per market order of negative 0.031 pips (over the last 400 market orders). My execution speed is about 800ms, i trade London + NY, and rarely make market orders at news times. I wouldn't worry too much about slippage for your back testing

http://www.forexfactory.com/showthread.php?t=337224
Update Backtest








@Levi - My short answer is "Yes, slippage matters". Unfortunately, there seems to be nothing you can do to avoid it, or at least nothing that I have found. I can't speak for algorithmic trading because I have never done this live, I'm just getting started. But I have "analyzed" manual trades for a long time. One analysis I did had a strategy making millions over time. When I included slippage in the equation, I found that the same strategy was profitable up to about 8 cents per trade slippage. Anything over that and the millions went away and the strategy lost. I'll be interested in seeing what actual live traders say, but at this point, I am also "betting" that the positives and negatives will cancel each other out to at least be profitable. Hey, I'm not greedy - I'll take thousands if I can't have millions!
1

Agree with Oran, short answer is yes it matters -- but long answer is it depends on the liquidity of your underlying asset. The snippet you posted refers to FOREX -- which are the most liquid assets in the world, so generally speaking there you'll get a price you expect.

I traded a near HFT (15sec-30min) algorithm for 2 years with live capital, and whether slippage matters depends on the absolute delta of price you're seeking. If you trade on these short horizons, then slippage probably matters since its likely the total price move you're seeking to capture is also small; i.e.

Buy in market at $200.10 (+- 2c spread) - so fill at 200.12, last trade price moved to 200.14 (+- 2c spread). If you sell now at market, you would get 200.12 (asking price) -- for 0c gain. Or you could place a limit order for 200.14, potentially increasing gain to 2c/share. But there's a x% chance you won't fill the order and it'll turn into a bad trade. Also if there's only 10 shares @ 200.12, and you're selling 100 you'll be filled at 200.11, resulting in a -1c loss! This is what the slippage models are for :)

"When incorporating this into my algorithm the results are rather depressing and is always a net loss." - Honestly this is the best thing that could happen :) Better now than in live trading when you're using real money. QC users are benefiting from years of my experience trading live and building a realistic platform to model your algorithms.

Short answer:
1 - This isn't a get rich quick scheme. Aim for a better sharpe ratio than the S&P and call it a win when its greater than 1-3. After 3 years full time I got my live algorithm to 3.2 sharpe.
2 - Define your goals in advance, and accept with higher goals comes higher risk because of #1. Sharpe is risk adjusted return, if your return is 1000% per year with 0.8 sharpe, its still better to invest in the S&P500.
3 - Fortunes are made by predicting the markets just 50.1% of the time, you don't need a high win rate.
4 - HFT is risky and depends heavily on infrastructure. Why not aim for 1-10 minute hold periods instead which have higher price movements? e.g. AAPL/TSLA/NFLX - highly volatile, also highly liquid and low spread. Ideal for an algorithmic strategy. You could use second level data which still gives you plenty of data to make trades. You could use universe selection to pick out these symbols based on daily trade volumes and ATR.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


@Oran, that's very insightful! I think we're in the same boat.

Curious, do you have a technique for estimating slippage from tradebar info (ohlcv)? I think (hope rather) my function is overestimating it.
0

@Jared or Michael, but anyone can answer - universe selection is one of the items on my bucket list, after I figure this coding thing out :). The strategies I use in manual trading work best with stocks with a big daily ATR. The bigger the better! I don't really care if a stock closes a penny from where it opened the day, if it moved up a dollar and down 99 cents, I make $1.99 per share. That is what got me interested in algorithmic trading. My question (filed away for now but food for thought) is: Can universe selection be used to find stocks with big swings? I suspect it is just the thing I need, but I haven't played with it yet. Finding stocks that fit the bill is a pain manually!
0

@Jared, you are like a wise Buddha. Thank you for your insight!
0

@Levi - No, I don't really have a technique. In my manual trading I just hope for the best and don't worry about it. If I see slippage hurting me I enter my orders sooner to "try" and offset it. Can't adapt an algorithm on the fly though, so please do keep trying to model it. Maybe you will find the holy grail :)
0

@Oran, yes you can make a universe defined based on large ATR's: here's an example of making a universe based on moving average crosses.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


@Jared - OK, now you have got me intrigued. I am going to have to start playing with universe selection - just as soon as I make sense of the Greek or Russian or something else all of this stuff is written in :)
0

Hello,  I have a question,  when the function GetSlippageApproximation returns a  value > 0 it's positive slippage ?.  and negative when  < 0 ?. Or it depends on the order  (BUY vs SELL ). 

 

0

I believe spillage is always positive; It's (price * slippage spread.) Now whether or not it gets added to or subtracted from the sale is determined by the order type as you can see in QuantConnect's ImmediateFillModel.cs:

            //Calculate the model slippage: e.g. 0.01c            var slip = asset.SlippageModel.GetSlippageApproximation(asset, order);

            //Apply slippage            switch (order.Direction)            {                case OrderDirection.Buy:                    fill.FillPrice += slip;                    break;                case OrderDirection.Sell:                    fill.FillPrice -= slip;                    break;            }

1

//Calculate the model slippage: e.g. 0.01c
var slip = asset.SlippageModel.GetSlippageApproximation(asset, order);

//Apply slippage
switch (order.Direction)
{
case OrderDirection.Buy:
fill.FillPrice += slip;
break;
case OrderDirection.Sell:
fill.FillPrice -= slip;
break;
}

 

0

Thanks  Levitikon.  If I undertand the  code correctly, I  actually can  create  positive/negative  spillage. For example if the  order is BUY and I return a negative number from GetSlippageApproximation,  I would get a positive spillage.   I was  thinking in create a model base on this numbers:

  1. 76.2% of all orders had NO SLIPPAGE.
  2. 13.5% of all orders received positive slippage.
  3. 10.2% of all orders received negative slippage.
  4. Over 58% of all limit and limit entry orders received positive slippage.
  5. 52% of all stop and stop entry orders received negative slippage.

From this page.

0

Slippage will definitely matter and I'd say one key element that you'd want to account for and mitigate is market impact.  On bid ask spread, unfortunately I don't see how to get realistic high frequency results unless you're backtesting on at least top of the book BBO quotes (as opposed to just trades/Bars).  on mitigating market impact (but this you can't really see within QuantConnect), you may want to limit your "trading intensity" so that you're trading a certain fraction of a rolling window of trading volume.

0

@Levitikon How often do you trade? Is your algo really that high frequency?Do you also take into account that slippage scales with order size? Instead of assigning a fixed dollar amount to slippage, I personally prefer a function of size.

Also, high frequency algos often seem more profitable because of compounding. Have you tried non-compounding?  

0

@Levitikon, If you consider flexibility in order types, you could reframe the issue entirely. It's possible to see potential price improvements or what I define as 'positive slippage' if using only limit orders. Worth noting that Ernie Chan talks about his CTO building their execution system that was able to achieve 'negative slippage' (pretty sure we're talking about the same thing, just using different terms) on his site and interviews I've read.
0

On a related note I am wondering how the market order price is determined in the lean engine. Using SPY as an example, we have a bid/ask of 210.45/210.46. If I am using a market buy order in the backtest does lean use 210.46 or 210.45? I am experimenting the impact of slippage so I am wondering whether I need to add 1cent of slippage in the backtest if I am using market order in the backtest engine? Thanks.

0

LEAN defaults to using the last trade price. If you have bid or option data

you can try using it for your fills.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thanks Jared:-)
0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed