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 GussJ, 03-04-2020, 03:11 PM
        16 responses
        3,279 views
        0 likes
        Last Post Leafcutter  
        Started by WHICKED, Today, 12:45 PM
        2 responses
        19 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Started by Tim-c, Today, 02:10 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Taddypole, Today, 02:47 PM
        0 responses
        5 views
        0 likes
        Last Post Taddypole  
        Started by chbruno, 04-24-2024, 04:10 PM
        4 responses
        52 views
        0 likes
        Last Post chbruno
        by chbruno
         
        Working...
        X