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 Radano, 06-10-2021, 01:40 AM
            19 responses
            604 views
            0 likes
            Last Post Radano
            by Radano
             
            Started by KenneGaray, Today, 03:48 AM
            0 responses
            3 views
            0 likes
            Last Post KenneGaray  
            Started by thanajo, 05-04-2021, 02:11 AM
            4 responses
            470 views
            0 likes
            Last Post tradingnasdaqprueba  
            Started by aa731, Today, 02:54 AM
            0 responses
            5 views
            0 likes
            Last Post aa731
            by aa731
             
            Started by Christopher_R, Today, 12:29 AM
            0 responses
            11 views
            0 likes
            Last Post Christopher_R  
            Working...
            X