Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Question about slippage/sim strategies

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

    Question about slippage/sim strategies

    Hello,

    I noticed Ninja sim trades seem to be realistic, in that it won't instantly fill, but until a "real" contract is available on the other end of the market. Am I wrong on this?

    Anyways, I'm running strategies on sim accounts, and they are not realistic to my backtest data. This is fine, because I think that the sim is automatically incorporating slippage with the market orders and what not, even though I set the slippage to "0" when creating the strategy in the strategy tab.

    So I'm wondering if the Ninja sim trades, whether they be automated market orders or live limit orders, are very realistic in slippage and only filling limit orders if there is a buyer/seller in the market.

    #2
    Hello,

    Thanks for the note.

    Your assumptions are correct.



    he simulation engine is not a simple algorithm that fills your order once the market trades at your order price. The engine uses a scientific approach to determine fill probability by including a number of variables including: ask/bid volume, trade volume, time (to simulate order queue position), and random time delays for switching between order states.

    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Got it. Definitely impressive... thanks for your continued support.

      Comment


        #4
        Brett,

        I apologize for my ignorance on this...

        Is it possible to get the strategies running live to use limit orders and not market orders? It seems like there is usually 2-6 ticks of slippage on strategies since they use market orders, and that some of the slippage could easily be corrected with more staunch orders... thanks, C

        Comment


          #5
          Hi crimsonite,

          Yes, NinjaTrader supports limit orders in manual trading and NinjaScript strategies.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Problem with strategy: Chart seems to be tracing backwards

            Hi there,

            I have a strategy coded, and when I run it the chart seems to show on many occasions the trade happening in backward in time (see attached Chart PNG called 'backward'), and the report (see attached report PNG called 'backward_report') shows the Market Position as Short, even though I only enter long positions (using the EnterLong() method) in the strategy.

            How can it show the trade happening backwards? Why is it shown as a short and not a long?

            Many thanks,
            Attached Files

            Comment


              #7
              Originally posted by NinjaTrader_RyanM View Post
              Hi crimsonite,

              Yes, NinjaTrader supports limit orders in manual trading and NinjaScript strategies.
              Okay thanks... I checked back to the strategy gui, and didn't find anything on limit orders there or in the help menu.

              Is it possible to insert a piece of code to the strategy that will do limit orders at the ask or something?

              I'm sorry for being a newb about this... thanks for your help.

              Comment


                #8
                Originally posted by crimsonite View Post
                Okay thanks... I checked back to the strategy gui, and didn't find anything on limit orders there or in the help menu.

                Is it possible to insert a piece of code to the strategy that will do limit orders at the ask or something?

                I'm sorry for being a newb about this... thanks for your help.
                Please check into the snippet offered here and use the GetCurrentAsk for example as price in your case - http://www.ninjatrader.com/support/h...EnterLongLimit

                Comment


                  #9
                  Originally posted by adam_norsworthy View Post
                  Hi there,

                  I have a strategy coded, and when I run it the chart seems to show on many occasions the trade happening in backward in time (see attached Chart PNG called 'backward'), and the report (see attached report PNG called 'backward_report') shows the Market Position as Short, even though I only enter long positions (using the EnterLong() method) in the strategy.

                  How can it show the trade happening backwards? Why is it shown as a short and not a long?

                  Many thanks,
                  Hi Adam, what kind of chart / timeframe are you using here to run this strategy? Are you generating those statistics with backtesting or realtime trading the Sim101 account?

                  Comment


                    #10
                    Originally posted by NinjaTrader_Bertrand View Post
                    Please check into the snippet offered here and use the GetCurrentAsk for example as price in your case - http://www.ninjatrader.com/support/h...EnterLongLimit
                    Awesome, thanks for the help!

                    The problem I'm trying to solve is that my strategy has a profit target of 4-6 ticks. It can handle up to 3-4 ticks of slippage (this is all based on the startegy analyzer backtests). However when I go live, it is profitable every other day at best, because the market orders plus the spread are causing 4 ticks or more of slippage.

                    In backtesting, the strategy has bad data with the limit orders.

                    Setting fill type to "liberal" does not seem to solve this.

                    How can I solve this? Trade this live and use limit orders myself? I know for sure my strategy works, I'm looking at the data, the slippage and the charts... it's just the 4+ ticks of slippage. Usually I should prepare for 1-2 ticks according to most.

                    Comment


                      #11
                      Liberal should not be used in this case, as it can overstate historical performance by filling you on a touch for limit orders, stay with the more conservative default type here in backtesting. What chart type and timeframe are you working on? Have you tested it as well in replay mode?

                      One way around is placing a limit order in live trading at the close price of your signal bar, but the downside is : it could leave you unfilled. You could also try changing the target, as a result of the execution you've received with the live market order, so theoretically you know where you're expected target is : the signal bar close + the tested target ticks...so you could then lower target for the differencde seen between signal bar close and your actual execution seen live.

                      Comment


                        #12
                        Hi NinjaTrader_Bertrand, I am using 6E candlestick chart, each candle = volume 144. I am generating these stats using a strategy backtested.

                        All the best,

                        Comment


                          #13
                          Originally posted by adam_norsworthy View Post
                          Hi NinjaTrader_Bertrand, I am using 6E candlestick chart, each candle = volume 144. I am generating these stats using a strategy backtested.

                          All the best,
                          Thanks, is this your own coded strategy or a vendor / 3rd party one?

                          Please retry your backtest with complete fresh data :

                          1. Close NT7 down
                          2. Go to \Documents\NinjaTrader 7\db\cache and delete the sub(!) folders here
                          3. Restart NT7, reconnect to your provider and open your 6E volume chart and right click in it to 'reload historical data'
                          4. Re-backtest your strategy now.

                          Comment


                            #14
                            Originally posted by NinjaTrader_Bertrand View Post
                            Liberal should not be used in this case, as it can overstate historical performance by filling you on a touch for limit orders, stay with the more conservative default type here in backtesting. What chart type and timeframe are you working on? Have you tested it as well in replay mode?

                            One way around is placing a limit order in live trading at the close price of your signal bar, but the downside is : it could leave you unfilled. You could also try changing the target, as a result of the execution you've received with the live market order, so theoretically you know where you're expected target is : the signal bar close + the tested target ticks...so you could then lower target for the differencde seen between signal bar close and your actual execution seen live.
                            Thanks so much for the input. I'll try it tonight when I get back home in a couple hours.

                            I have not done market replay data. Is it possible that backtesting fills just on the 'last', and the replay could prove the system to be complete garbage?

                            I tried using limit orders, but it looks like it won't exit because the entire trade list are entries only. There is also the problem (you mentioned) of leaving something unfilled. Maybe it'd be possible to nullify an order after a couple of bars has passed or something? Thanks again for your continued support...

                            Comment


                              #15
                              Market replay is a good way of simulating real time strategy behavior, mainly because you can speed up the playback and it will still function the same as if played back on 1X. Yes, it's possible to design strategies that backtest well but don't perform well in real time conditions. We encourage everyone to consider backtesting as only one step in the entire strategy development process.

                              I tried using limit orders, but it looks like it won't exit because the entire trade list are entries only. There is also the problem (you mentioned) of leaving something unfilled. Maybe it'd be possible to nullify an order after a couple of bars has passed or something?
                              Nullifying orders would be used when you structure your order as IOrder, part of advanced strategy design. It would be good to understand the basics of strategy order submission before needing to work with IOrders and their object lifecycle. If you do want to get into this right now, this sample is a good introduction to CancelOrder:
                              When using NinjaTrader's Enter() and Exit() methods, the default behavior is to automatically expire them at the end of a bar unless they are resubmitted to keep them alive. Sometimes you may want more flexibility in this behavior and wish to submit orders as live-until-cancelled. When orders are submitted as live-until
                              Ryan M.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              646 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              367 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              107 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              569 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              573 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X