Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple Timeframes in a strategy

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

    Multiple Timeframes in a strategy

    I was trying to use a strategy in NT7 which worked fine in NT6.5 but is now giving me problems even though I had no problems compiling it.

    My strategy uses various interval charts of the same instrument to calculate different indicator values. Previously I added the interval in the "initialize" section and then retrieved my values using "BarsInProgress==1,2...etc."
    Now this doesn't seem to work, though I don't get an error message.

    Based on the new multi-interval chart capability it strikes that perhaps I now must add indicator values from a different timeframe in a different manner from before. Is this correct? How do I do it?

    Thanks,

    Ron

    #2
    Ron, the basic concepts have not changed, they have just been extended to indicators - would have a simplified snippet you could share so we could check into?

    Is the strategy working fine if reduced for example to the primary frame?

    Comment


      #3
      OK, When I run this strategy nothing prints which means it not processing the commands inside this initial loop. (The "MPValues" indicator is currently working fine in NT7 after some editing of the 6.5 version.)

      Here's part 1 in the initialize section:

      protected override void Initialize()
      {

      CalculateOnBarClose = true;
      Add(PeriodType.Minute, 30);


      }

      Here's part 2 in the "OnBarUpdate" section

      if (BarsInProgress ==1) //Here we're going to use the imbedded 30m chart to determine MP levels which will act as support and resistance
      {
      if (ToTime(Time[0]) == 10000)
      {
      SessionNmbr=SessionNmbr+1;
      if (SessionNmbr >= 2 && ConsiderMP==1)
      {


      }
      amVAH[0] = MPValues(BarsArray[1],false, 8, 30, 0.7, "TPO", 6.5).VAH[0];
      amVAL[0] = MPValues(BarsArray[1],false, 8, 30, 0.7, "TPO", 6.5).VAL[0];
      amPOC[0] = MPValues(BarsArray[1],false, 8, 30, 0.7, "TPO", 6.5).POC[0];


      Print ("Session# =" + SessionNmbr + " POC[0]="+amPOC[0] + " VAH[0]="+ amVAH[0] + " POC[1]=" + amPOC[1] + " VAH[1]=" + amVAH[1]);

      }

      }

      Comment


        #4
        I should add that I just tried adding a simple statement,

        Print ("test");

        to one of my working strategies, and I didn't get anything to print. I'm assuming this is a bug of some sorts that may have nothing to do with multiple timeframes.

        Ron

        Comment


          #5
          Ron,

          Please test with this simple strategy, printing 30 min added bars series close.

          Does it print as expected to the output window?

          Thanks
          Attached Files

          Comment


            #6
            Please also ensure you have no errors in your Control Center logs. Thank you.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              The strategy you posted does not result in any printing, and there are no errors in my logs.
              I ran the strategy both on a tick chart and a 30m chart. Nothing showed in either case.

              Ron

              Comment


                #8
                Ron, thanks - so when you have a chart open, strategy applied and enabled, open the output window, return then to the chart with the strategy and press F5 to reload NinjaScripts - it does not print for you, correct?

                Is the SampleMACrossOver strategy working as expected?

                Do all files compile as you would expect?

                Comment


                  #9
                  Bertrand,

                  There is no printing when I follow your instruction exactly.

                  I have been testing a custom strategy in the strategy analyzer and my results have been within expectation. I tried testing a more complex strategy based on that same strategy, but which uses S/R levels calculated from a different time frame. The results from this strategy had been markedly better when tested in 6.5, but here they were worse. Therefore I sought to print out the the strategy's calculated S/R levels. When I tried to do this nothing printed.

                  But now I realize that none of my strategy's (even the included ones such as Sample MA crossover) are giving any results on my live chart even though they work in the strategy analyzer.

                  So its not just a print issue--no strategies are working on my live charts.

                  Ron

                  Comment


                    #10
                    Ron, thanks for the reply - we just released NT 7 beta 9 - can you please retry those strategies on a clean install of beta 9 and then let me know if you're able to reproduce those issues?

                    Thanks

                    Comment


                      #11
                      I loaded the update.

                      Same issues as before.

                      Ron

                      Comment


                        #12
                        Ron, thanks for reporting back - please try a 100% clean reinstall of the latest beta 9 release (uninstall present NT7, delete MyDocuments > NinjaTrader 7 folder, reinstall from our link).

                        Then please retest with my sample posted and our default SampleMACrossOver, as there are still some issues present with MultiSeries scripts.

                        Thanks
                        Last edited by NinjaTrader_Bertrand; 02-11-2010, 08:50 AM.

                        Comment


                          #13
                          I did a clean load of 7.0.0.9.

                          I ran the sample MA x-over strategy on the live chart.

                          No trades were made by the strategy in 10-days.

                          I ran the TestMTF strategy and nothing showed up in the output box.

                          Ron

                          Comment


                            #14
                            Ron,

                            Please try the Strategy Analyzer for your tests. Running a strategy from a test has a bug in B9 that does not plot historical trades, but will only do so going forward.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Regarding the initial problem of strategies not working on live charts, I think I found the problem: Under the "strategies" tab in the control center there is an "enable" box in the last column for each active strategy. It seems the strategies have been defaulting to "not enabled". After checking the "enable" box the strategies seems to be working on the real-time charts.

                              Regarding the output window I now have a new strange problem: Unless the output window is maximized it seems to be situating itself off screen. It shows up on the program bar at the bottom of the screen but when I click on it, it seems to open up and move off screen. If I maximize it shows up as expected.

                              The output of the posted TestMTF strategy is as expected in the output window, but only after I enable the strategy in the Control Center window under the "strategies" tab.

                              I've run the optimizer and it seems to be working as expected--i.e. there are historical trades listed and the results change for the various input parameters--but the results are not similar to what I was getting before. There may be reasons for this on my end as I am not yet looking closely at my parameters, I'm just trying to get it to show something.
                              Ron

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              605 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              351 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              105 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              560 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              561 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X