Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Slippage in backtesting / optimization Strategy Analyzer

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

    Slippage in backtesting / optimization Strategy Analyzer

    I'm not seeing the slippage I specify being applied to the results.

    My strategy makes a trade in the backtest when set to use 1 pip slippage.

    Code:
    [FONT=Courier New][SIZE=2]
    1    $AUDUSD    Backtest    TrendFollower003    Long    200000    0.6181    0.6139    03/07/1998 19:00:00    06/07/1998 06:00:00    Go Long    exit long    -848.000000000019    -848.000000000019    8    840.000000000019    0    0    2[/SIZE][/FONT]
    I set slippage to 20 pips and got the same result.

    How does this work? Should I be doing more than just adding the slippage pips into the backtest properties? Is it broken?

    Using beta 15.

    Thanks.

    #2
    Hello adamus,

    Are you saying that orders are executed at the exact same price when you set slippage to 20?

    When I backtest the SampleMACrossOver strategy with 'Slippage' set to zero and 20, I do receive different results. What happens if you backtest the SampleMACrossOver on your end with and without slippage?

    Comment


      #3
      This is with zero slippage:

      1 $AUDUSD Backtest SampleMACrossOver Long 100000 0.8977 0.898 31/12/2009 22:27:00 31/12/2009 22:33:00 Buy Close position 24.9999999999967 24.9999999999967 5 0 29.9999999999967 5.00000000000001 7


      and this is with 20 slippage:

      1 $AUDUSD Backtest SampleMACrossOver Long 100000 0.898 0.898 31/12/2009 22:27:00 31/12/2009 22:33:00 Buy Close position -5 -5 5 29.9999999999967 0 0 7




      Last edited by adamus; 05-06-2010, 10:34 AM.

      Comment


        #4
        In case it helps, these are the settings:

        Code:
        Item,Value,
        Parameters,,
        Fast,10,
        Slow,25,
        Data series,,
        Price based on,Last,
        Type,Minute,
        Value,1,
        Time frame,,
        From,01/01/2010,
        To,05/05/2010,
        Session template,<Use instrument settings>,
        General,,
        Include commission,True,
        Label,SampleMACrossOver,
        Maximum bars look back,TwoHundredFiftySix,
        Min. bars required,20,
        Historical Fill Processing,,
        Fill type,Default,
        Slippage,20,
        Order Handling,,
        Entries per direction,1,
        Entry handling,AllEntries,
        Exit on close,True,
        Order Properties,,
        Default quantity,100000,
        Set order quantity,by default quantity,
        Time in force,Gtc,
        Last edited by adamus; 05-06-2010, 10:35 AM.

        Comment


          #5
          In this strategy, NT has taken 3 pips for the entry, and left the exit untouched.

          Comment


            #6
            Can you please check if you see a difference as per the Total Net Profit between the two tests.

            Comment


              #7
              Yes it's applied in the Total Net Profit.

              Shouldn't it also be displayed in the prices of the trades? There is something going on there in the prices displayed for the trades, but it's not right.

              Comment


                #8
                Hello adamus,

                We are looking into the issue - thank you for reporting.

                As soon as there is news regarding the matter, I will let you know.

                Comment


                  #9
                  adamus,

                  Slippage is added or subtracted from your entry and exit prices. What happens is that at some point in time having a slippage of 20 ticks doesn't make sense with the information being displayed on the bars. If the slippage would bump the price outside the range of the bar you would still be filled within the bar's range. If you do a side by side comparison of no slippage vs slippage you will be able to find these differences throughout the trades.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    I just want to verify that my observations are correct regarding slippage when I am running a strategy live.

                    If I set the slippage to 1 tick, then during the run-up phase of processing using past data, the strategy will log trades with this given slippage applied only to the exit trade.

                    The given slippage amount is obviously not applied to live executions.

                    Please correct me if I am wrong.

                    Thanks

                    Comment


                      #11
                      Slippage is applied for both entry and exit orders. It will be applied on historical data only and not when trading live on real-time data.

                      Comment


                        #12
                        Originally posted by NinjaTrader_Jason View Post
                        Slippage is applied for both entry and exit orders.
                        I am seeing trade entries that don't show the application of any slippage.

                        I am aware of what you told me higher up in the thread - that slippage is only applied to the extent possible defined by the high and the low in the given bar - but I checked this on two trades just now and only the exits have the slippage applied. I tried this with different levels of slippage - 0, 1 and 2 ticks - and in each case the entries were the same but the exits showed different slippage.

                        I am testing on AUDUSD. This is what it looked like (and the prices are all within the high and the lows):

                        Bar OHLC entry 1
                        0.95610
                        0.95670
                        0.95470
                        0.95530

                        Ticks slippage property setting & execution
                        0 0.95485
                        1 0.95485
                        2 0.95485

                        Exit 1
                        0.9588
                        0.9601
                        0.9587
                        0.9599

                        0 0.95880
                        1 0.95875
                        2 0.95870

                        Entry
                        2
                        0.96040
                        0.96170
                        0.95860
                        0.95960

                        0 0.95915
                        1 0.95915
                        2 0.95915

                        Exit 2
                        0.95940
                        0.96020
                        0.95840
                        0.95850

                        0 0.95940
                        1 0.95935
                        2 0.95930

                        Could you just double check that for me?

                        Thanks

                        Comment


                          #13
                          Do you experience the same outcome when you test the SampleMACrossOver strategy?

                          When I test the SampleMACrossOver strategy on my end, slippage is applied to both entry and exit orders.

                          Could it be the issue is related to that strategy only?
                          Attached Files

                          Comment


                            #14
                            OK, I see slippage on the entry orders in SampleMACrossOver.

                            Do you apply slippage to all order types? The entries in my strategy are limits, and the exits are mkt or stp orders.

                            Comment


                              #15
                              Slippage is only applied to market and stop market orders. Limit orders would not have slippage as limit orders will only be filled at the limit price.
                              Josh P.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              601 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              347 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              559 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              558 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X