Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Slippage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Slippage

    When we enter slippage on a strategy in number of ticks, I am not too clear on what "ticks" it is referring to.

    When we have tick data, each transaction is referred to as a tick, right?
    I have attached a screenshot from my renko strategy, and it has slippage set to 1. On the 3rd bar, you can see it went short at a price of 1392.50, and the bar opened at 1392.75. I added a second data series to the strategy of single ticks.

    Add(PeriodType.Tick, 1);

    When I print out the onBarUpdate data for the tick series and the better renko series I see that for that bar there are 2022 ticks. The first 56 ticks are all at the price 1392.75. It isn't until tick 57 that it gets the price 1392.50. So why does a 1 tick slippage get in at the price of 1392.50? Am I using the wrong definition of tick?

    Also, to see the prices and how many ticks I did the following:
    // BetterRenko 9
    if ( BarsInProgress == 0 )
    {
    Print("::::"+Close[0]);

    And

    // Tick 1
    else if ( BarsInProgress == 1 )
    {
    // NOTE: make sure we exit current position before entering new...
    Print(":"+Close[0]);
    So the output for the trade I am using as my example for the question is:
    ::::1392.75
    :1392.75
    Entering simShort @1392.75
    :1392.75
    :1392.75
    ... repeated 54 more times
    :1392.5
    :1392.5
    :1392.5
    :1392.75
    :1392.75
    :1392.75
    :1392.75
    :1392.5
    :1392.5
    :1392.5
    ... and so on
    According to the BMT Wiki, Tick is the minimum amount an instrument can move. For example s&p 500 mini futures has a tick of 0.25, this mean the price can change of an incremental of 0.25 or 1/4 of point, and the tick value is $12.50. So does a 1 tick slippage mean we just have each trade go against us by $12.50? This doesn't make sense because some trades the slippage goes in our favor. Does it look for the first price change of a tick and use that? So in the above... we fired the order at price 1392.75, and the first price that had changed by a tick (0.25 ES) was the one at tick 57, where it went to 1392.50... so is that why it used that price with a slippage of 1?
    Attached Files

    #2
    d1g1talfr3ak, a tick would be the minimum move of an instrument, so for the ES 0.25 or 12.50$.

    Slippage would be added per execution for all non limit orders.

    It would not take into consideration positive slippage that could occur as well, so it's a conservative estimate.

    Comment


      #3
      Thanks!

      Thanks... that answered my question.

      Also, the code in @DefaultFillType helped


      Code:
      				if (order.OrderAction == Cbi.OrderAction.Buy || order.OrderAction == Cbi.OrderAction.BuyToCover)			// set fill price
      					FillPrice = Math.Min(NextHigh, NextOpen + SlippagePoints);
      				else
      					FillPrice = Math.Max(NextLow, NextOpen - SlippagePoints);
      Now I understand why I am getting in and out at certain prices. Thanks.

      Comment


        #4
        Thanks for the update, glad to hear!

        Comment


          #5
          Okay.. I am back again. That solved my question as far as backtesting is concerned... I can now simulate trades to track the equity curve even when I'm not in a trade. I have created an equity curve indicator that shows the equity curve plotted in real-time and it now matches exactly what ninjatrader shows when I backtest. I am able to simulate the accurate entry and exit prices using the inputted slippage.

          Now, when I run it in Market Replay mode... my simulted trades no longer match the entry and exit prices that ninjatrader chooses during market replay. Does Ninjatrader use a different filling algorithm during market replay? Does it even use the slippage value entered? It appears to not be using the slippage. Does it instead determine what price it thinks you could really get in at and out at based on the order of the underlying data? If so, can you enlighten me as to how it does that?

          It does appear that sometimes the trade does incur a slippage, but more often I am seeing it not. Does it assumed a certain number of transactions will occur before we get our entry? A certain amount of time?

          Thanks in advance for your hep.

          Comment


            #6
            Correct, slippage is a backtesting item - for live sim trades or market replay trades the state of the art simulation engine would determine fill probabilities and execution prices via estimated q positions.



            Also, keep in mind market replay has access to the intrabar formation of the bars as it's truly recorded live data, this will add realism in combination with the sim engine above.

            Great to hear on the nice work for the equity curve rebuild...

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            77 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            45 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            27 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            32 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            63 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X