Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MTF NT7 backtest

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

    MTF NT7 backtest

    Hi, if I use the code "Add(PeriodType.Minute, 60) and then reference it with a BarsArray[1] etc the same way I do in NT6.5, in the backtest it enters the first trade and stays in no matter what till the end of the test period. Is there a change in the way this needs to be coded?
    Thanks

    #2
    Stem,

    This should work in 7. What are you using for your exit condition as I would check there, also are you using BarsInProgress in your code?

    Have you added TraceOrders=True to your Initiliaze method to trace your orders to see what is occuring?
    BrettNinjaTrader Product Management

    Comment


      #3
      Exit condition is profit target or stop loss, which works fine before I add the second timeframe.
      I haven't been using "BarsInProgress", as I haven't been using it in NT6.5.
      eg; Add(PeriodType.Minute, 60); in the initialize
      and SMA(BarsArray[1], 50)[0] > SMA(BarsArray[1], 50)[1] in condition set works in NT6.5 but not in 7.
      I tried to add "TraceOrders = Trua;" and then "TraceOrders == True;" in the initialize section of the code but I get the "The name True does not exist" error on both attempts.
      Thanks

      Comment


        #4
        It WAS the missing BarsInProgress. Sorry about that, I need to get more sleep...

        Comment


          #5
          OK, I added the "if (BarsInProgress ==0) line but N7 still takes the first trade and stays in till the end of test period ignoring the Profit target and Stop loss. On my second machine with N6.5 I have the same code and it performs as expected.
          I would still like to know how to get the "trace orders" to work.
          Thanks

          Comment


            #6
            Stem,

            What are you using to set your profit target and your stop loss?

            Please see the following guide for TraceOrders.



            Then open the output window by going to Control Center->Tools->Output Window and then run your strategy.
            BrettNinjaTrader Product Management

            Comment


              #7
              Also, please see this great tip guide on TraceOrder.

              BrettNinjaTrader Product Management

              Comment


                #8
                I use the same PT and SL as with the backtest without the addition of the second time frame.
                I just ran a test where I removed the "Add(Per", "BarsInPro" ,"BarsArray" lines from the code an ran a backtest without touching the PT and SL and it performed as expected.
                I then add the "Add(PeriodType.Minute, 60);" line without the other two lines and it did the "take the first enty and stay in till end of test period".

                Comment


                  #9
                  Glad to hear. Thanks for posting the fix!
                  BrettNinjaTrader Product Management

                  Comment


                    #10
                    That's not the fix, I was describing how I've narrowed the problem down to the writing of the "Add(PeriodType..." line of code.

                    Comment


                      #11
                      In this case for me to further assist I would need to take a look at your code. There is something that is missing in regards to running a multi-series strategy since it does work when you add the Multiseries.

                      Can you please send your strategy to support at ninjatrader dot com and reference this forum post and put attn Brett in the subject line and I will take a quick look to see whats causing this.
                      BrettNinjaTrader Product Management

                      Comment


                        #12
                        I just upgraded to beta15 and the problem has gone.
                        Thanks

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                        0 responses
                        597 views
                        0 likes
                        Last Post Geovanny Suaza  
                        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                        0 responses
                        343 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
                        556 views
                        1 like
                        Last Post Geovanny Suaza  
                        Started by RFrosty, 01-28-2026, 06:49 PM
                        0 responses
                        555 views
                        1 like
                        Last Post RFrosty
                        by RFrosty
                         
                        Working...
                        X