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-Time Frame Processing Question

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

    Multi-Time Frame Processing Question

    Question: Is there a guaranteed order in which the Bars Objects will be called?

    ie.

    if I have a 1 minute primary, a 2 minute and a 3 minute (indices of 0,1,2 respectively)

    When onBarUpdate() is called, can I rest assured that the indices will be called in the same order that they are added?

    so first I'll evaluate my 1 minute, then my 2 minute and lastly my 3 minute bar object?


    And is this true for both indicators and strategies?


    Thanks

    Matt

    #2
    Matt, I will have someone get back to you tomorrow regarding this question.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Austin View Post
      Matt, I will have someone get back to you tomorrow regarding this question.
      Do we have an answer to this... Print statements show that things are fairly random....

      Would like to know what behaviors I can (or can't) expect from this....

      Thanks

      MAtt

      Comment


        #4
        Matt, the bars objects get called in the sequence they're added - if you have bars with the same timestamp, they are also processed in the original added order, please also check into this sample below -

        You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Just to be clear....

          If I have a primary that is 1 min, and I add() a 2 min in initialize,

          Then in OnBarUpdate() I have

          Code:
          {
          
          if(BarsInProgress==0)
          {
          // should print out twice ... 
          Print("BIP 0");
          }
          else if(BarsInProgress==1)
          {
          // should print out once...
          Print("BIP 1");
          }
          I should ALWAYS have in my output (in this order):
          BIP 0
          BIP 0
          BIP 1

          I'm just wanting to make sure that it can't ever be:

          BIP 1
          BIP 0
          BIP 0

          or
          BIP 0
          BIP 1
          BIP 0


          Thanks

          Matt

          Comment


            #6
            You're understanding is correct, for easier checking you could also use PrintWithTimeStamp -

            Code:
             protected override void OnBarUpdate()
            		{
            			if (BarsInProgress == 0)
            				PrintWithTimeStamp("BIP0");
            			
            			if (BarsInProgress == 1)
            				PrintWithTimeStamp("BIP1");
            		}
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by mmenigma, Today, 02:22 PM
            0 responses
            2 views
            0 likes
            Last Post mmenigma  
            Started by frankthearm, Today, 09:08 AM
            9 responses
            35 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by NRITV, Today, 01:15 PM
            2 responses
            9 views
            0 likes
            Last Post NRITV
            by NRITV
             
            Started by maybeimnotrader, Yesterday, 05:46 PM
            5 responses
            26 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by quantismo, Yesterday, 05:13 PM
            2 responses
            21 views
            0 likes
            Last Post quantismo  
            Working...
            X