Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtest issues

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

    Backtest issues

    I've been backtesting strategies and have had a re-occurring problem. If I have a ProfitTarget set for 8 ticks from a buy entry, the backtest is showing a profit price on the same bar but the bar closes down. The entry price is hit on the way down and never goes back up to reach the ProfitTarget, but because both the entry price and the entry price + 8 ticks were present on that same bar (1 minute), the NinjaTrader Strategy Analyzer gives me a Bogus Profit. And it does this so frequently that it is basically rendering the backtest useless.

    I have gone back and looked at a 5 sec chart to confirm that the order in which the prices occurred would NOT yield a profit even though the NinjaTrader Strategy Analyzer says it would, because the ProfitTarget price occurred BEFORE the buy entry on the same 1 minute bar. How can this issue be resolved. Would using the Unmanaged Approach solve this problem in backtesting or what do you suggest?
    Thanks
    Last edited by kenb2004; 02-04-2011, 11:01 AM.

    #2
    Hello Ken,

    Yes, you may notice discrepancies between backtest and real time operation. Only the four data points OHLC are known, and not the sequence.

    To work around this you may consider running your strategy against market replay connection to simulate the real time operation.

    You can also add a secondary series for intrabar granularity. We have a sample available that discusses that here:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Why doesn't NinjaTrader use tick data for back testing intraday strategies? Is there any plan to in the future?

      Comment


        #4
        The capability currently exists with custom programming. Thank you for the suggestion to integrate this into the engine. I will forward to our development team.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Is there a sample of this custom programming?

          Comment


            #6
            Yes, provided in my first reply:
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              I can see that "entries" are affected by this SampleIntraBarBackTest but what about exits? If I use a 5 Second secondary bar series how are ProfitTargets and StopLosses affected in BackTest vs RealTime? Will this solve the BackTest Issue as described below?

              Comment


                #8
                For submitting exits to secondary series, you have to move away from Set statements and use ExitLongStop() or ExitShortStop(). Both offer overloads that allow you to submit to a secondary series.

                ExitShortStop(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double stopPrice, string signalName, string fromEntrySignal)
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  How about ProfitTargets? Will ExitLongLimit() work? Does ExitLongLimit() offer overloads that allow you to submit to a secondary series?

                  Comment


                    #10
                    Right - for profit targets the same applies so you will have to use ExitLongLimit(), ExitShortLimit()

                    EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName)
                    Ryan M.NinjaTrader Customer Service

                    Comment


                      #11
                      So the answer to my question in Post #1, "Would using the Unmanaged Approach solve this problem in backtesting?", the answer is: Yes, the only way to get an accurrate backtest is to use the UnManaged Approach with a secondary data series to backtest an intraday strategy. Is this correct?

                      Comment


                        #12
                        No, the unmanaged approach does not provide you increased granularity in backtesting. Unmanaged approach is typically only used when NinjaTrader's internal order management rules prevent you from submitting orders as desired.
                        Ryan M.NinjaTrader Customer Service

                        Comment


                          #13
                          So "EnterLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName) " is Advanced Order Handling but NOT UnManaged? Is this correct? Help me get to the bottom line, please. You understand my backtest issue, just tell me how to solve the problem until your development team puts tick data into the backtest. What's the best work-around for now?

                          Comment


                            #14
                            Hi Ken,

                            Yes, we've been discussing this in this thread.
                            • Add a secondary series that's smaller than your primary series.
                            • Submit exit orders to this series.
                            • This does not require unmanaged orders.
                            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
                            637 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            366 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
                            571 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X