Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Multi-timeframe/instrument problem

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

    Multi-timeframe/instrument problem

    Solved, thanks
    Last edited by kw123; 12-27-2009, 08:57 PM.

    #2
    Multi-time frame indicators are not supported in NT6.5. They will be in NT7.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      Multi-time frame indicators are not supported in NT6.5. They will be in NT7.
      Hi Josh, Thanks for your reply, but the code is a strategy, not an indicator, I just want to add more timeframes than the primary timeframe and the tick timeframe that's required.

      Comment


        #4
        kw123, it looks like you're heading in the right direction. What errors did you run into?

        To create a multi-instrument strategy you need to add the instrument (we'll use ES 03-10 in this example) in the Initialize() section:
        Code:
        protected override void Initialize()
        {
            Add("ES 03-10", PeriodType.Volume, 1000);
        }
        Then, you can just reference the additional instrument through Closes[1][n] like you already are in the code you posted.

        If you'd like, there is also a multi-instrument that comes pre-loaded with a NinjaTrader installation that you could take a look at from Tools -> Edit NinjaScript -> Strategy -> SampleMultiInstrument.
        AustinNinjaTrader Customer Service

        Comment


          #5
          Hi Austin, thanks for your reply.

          I've looked at the pre-loaded sample multi-timeframe/multi-instrument strategies, and tried to use them without any success.

          For example, if I use 5000 volume chart as my primary timeframe, add another 1000 volume as my secondary timeframe(which will be referred as BarsArray[2],because there a required tick timeframe) and change the following part in the code that refer to the primary to secondary:

          From

          PHP Code:
          else if ((base.BarsInProgress == 0) && (base.CurrentBar this.LastCurrentBar)) 
          to

          PHP Code:
          else if ((base.BarsInProgress == 2) && (base.CurrentBar this.LastCurrentBar)) 
          From

          PHP Code:
          if (base.BarsArray[0].CurrentBar >= Math.Max((this.L1 this.L2) - 1this.L3)) 
          to

          PHP Code:
          if (base.BarsArray[2].CurrentBar >= Math.Max((this.L1 this.L2) - 1this.L3)) 
          From
          PHP Code:
           if (BarsInProgress != )
                          return;            
            if(
          BarsInProgress==0)
                  {          Print(
          Time[0]+" "+VolumeSeries[0]);        } 
          to

          PHP Code:
           if (BarsInProgress != )
                          return;                            
                  if(
          BarsInProgress==2)
                  {        Print(
          Time[0]+" "+VolumeSeries[0]);       } 
          Then I ran this new strategy, the values I got is different from the values I got if I just ran the original strategy on a 1000 volume chart, which make me very confused.

          Comment


            #6
            kw123, you are running the strategy on another instrument/period, so it would make sense that the values don't match.

            You can try printing more values than just the time and your current data series (price, volume, open, high, low, etc) to help you verify which data set you're working with and such.
            AustinNinjaTrader Customer Service

            Comment


              #7
              Hi Austin, so if I understand correctly, the values from 1000 volume as a secondary timeframe on a 5000 volume primary timeframe chart will be different from the values of a 1000 volume as a primary chart with no secondary timeframe?

              Comment


                #8
                kw123, sorry for the misunderstanding. The values from 1000V as secondary should be exactly the same as from a 1000V primary.

                I suggest you start from a place where you know exactly what is going on, and slowly adding complexity, one layer at a time.
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  Hi Austin, thanks for your reply.
                  I guess I have to dig in to do some more debugging.

                  Comment


                    #10
                    This is a wild hunch, but the problem might be caused due to sequencing of the bar update calls. Since your volume charts are multiples of each other, the tick which cause the larger one to trigger will also cause the smaller one to trigger (or round abouts). The sequence in which the ticks for different bars are called might be causing some problem when you are looking for exact data. Try something which is not a multiple (say 1000, and 2500) and see how the results are.

                    Comment


                      #11
                      Originally posted by aviat72 View Post
                      This is a wild hunch, but the problem might be caused due to sequencing of the bar update calls. Since your volume charts are multiples of each other, the tick which cause the larger one to trigger will also cause the smaller one to trigger (or round abouts). The sequence in which the ticks for different bars are called might be causing some problem when you are looking for exact data. Try something which is not a multiple (say 1000, and 2500) and see how the results are.

                      Hi aviat72, thanks for your advice, I think too it may be something like that, but my programming knowledge is just too limited to figure it out myself.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Mathias79, Yesterday, 03:44 PM
                      1 response
                      22 views
                      0 likes
                      Last Post NinjaTrader_Gaby  
                      Started by Board game geek, Today, 01:34 AM
                      1 response
                      151 views
                      0 likes
                      Last Post NinjaTrader_LuisH  
                      Started by cencored, 03-31-2016, 05:09 PM
                      9 responses
                      2,455 views
                      0 likes
                      Last Post NinjaTrader_Erick  
                      Started by Human#102, 05-08-2024, 09:54 AM
                      3 responses
                      16 views
                      0 likes
                      Last Post Human#102  
                      Started by ETFVoyageur, Today, 06:11 AM
                      0 responses
                      5 views
                      0 likes
                      Last Post ETFVoyageur  
                      Working...
                      X