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-Instrument CurrentBar Question

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

    Multi-Instrument CurrentBar Question

    Hi,

    I'm developing a multi-instrument strategy adding 9 more instruments.
    Min bar is set to 20.

    I have the following code :
    Code:
    protected override void OnBarUpdate()
            {
                if (BarsInProgress != 0) return;
                Print("CurrentBar =" + CurrentBar);
                Print("CurrentBars[0] =" + CurrentBars[0]);
                Print("CurrentBars[3] =" + CurrentBars[3]);
                Print("CurrentBars[8] =" + CurrentBars[8]);
                Print("CurrentBars[9] =" + CurrentBars[9]);
            }
    The output I get is:
    CurrentBar =335
    CurrentBars[0] =335
    CurrentBars[3] =335
    CurrentBars[8] =335
    CurrentBars[9] =21
    CurrentBar =336
    CurrentBars[0] =336
    CurrentBars[3] =336
    CurrentBars[8] =336
    CurrentBars[9] =22
    CurrentBar =337
    CurrentBars[0] =337
    CurrentBars[3] =337
    CurrentBars[8] =337
    CurrentBars[9] =23
    CurrentBar =338
    CurrentBars[0] =338
    CurrentBars[3] =338
    CurrentBars[8] =338
    CurrentBars[9] =24
    CurrentBar =339
    CurrentBars[0] =339
    CurrentBars[3] =339
    CurrentBars[8] =339
    CurrentBars[9] =25
    CurrentBar =340
    CurrentBars[0] =340
    CurrentBars[3] =340
    CurrentBars[8] =340
    CurrentBars[9] =26
    CurrentBar =341
    CurrentBars[0] =341
    CurrentBars[3] =341
    CurrentBars[8] =341
    CurrentBars[9] =27
    CurrentBar =342
    ...
    Can you explain to me this outcome?

    TX,
    Roy

    #2
    What instrument / timeframes do you Add() here Roy? OBU() Processing would be started once all series have see the min bars required...

    Thanks,
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Do you mean that if 1 of the instruments have a less data all will wait for him to sync. with the other?
      The instruments are few stocks, time frame is daily and the data I'm getting is from Kinetick Real-time service.

      Comment


        #4
        Correct Roy, first OnBarUpdate() call you would see is where all series have satisfied their min bars requirements.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Austiner87, Yesterday, 11:24 AM
        2 responses
        12 views
        0 likes
        Last Post brucerobinson  
        Started by Rogers101, 05-05-2024, 11:30 AM
        3 responses
        21 views
        0 likes
        Last Post Rogers101  
        Started by nightstalker, 05-04-2024, 02:05 PM
        5 responses
        53 views
        1 like
        Last Post nightstalker  
        Started by MSerag, Yesterday, 11:52 PM
        0 responses
        11 views
        0 likes
        Last Post MSerag
        by MSerag
         
        Started by DynamicTest, Yesterday, 11:18 PM
        0 responses
        3 views
        0 likes
        Last Post DynamicTest  
        Working...
        X