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

Data.Bars.GetBars

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

    Data.Bars.GetBars

    Question refers to NT 6.5.1000.14

    If I call daily bars (also see pivots indicator) via

    isInit = true;
    Data.Bars.GetBars(Bars.Instrument,
    new Period(PeriodType.Day, 1), Bars.From, Bars.To, (Session) Bars.Session.Clone(), Data.Bars.SplitAdjust, Data.Bars.DividendAdjust);
    isInit = false;

    within an indicator, this produces a strange effect:

    OnBarUpdate() continues its course during this initialization process, so what happens is

    (1) OnBarUpdate() runs 5000 times
    (2) Initialization is completed and isInit is set to false;
    (3) OnBarUpdate() runs another 5000 times to complete the chart.

    The problem is here that the daily bars are only available, when the chart has been scanned halfway, which is not very helpful, as I want to use them right in the beginning!

    Is there any way to tell NT to please first complete the initialization of the daily bars and then continue to proceed with OnBarUpdate()?

    #2
    Unfortunately the method you are using is not NinjaScript but NT internal in thus we are unable to support it.

    Comment


      #3
      Just in case somebody else is interested

      When adding the code " if(isInit) return; " just after the section where the dailybars are loaded, OnBarUpdate() can do no harm (mainly by assigning any values to variables, which are then not properly intialized for the second run). The dailybars are then loaded and OnBarUpdate() will continue with the CurrentBar Value that started the initialization of the daily bars.

      So anything caused by OnBarUpdate() during the initialization just needs to be neutralized.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by burtoninlondon, Today, 12:38 AM
      0 responses
      9 views
      0 likes
      Last Post burtoninlondon  
      Started by AaronKoRn, Yesterday, 09:49 PM
      0 responses
      14 views
      0 likes
      Last Post AaronKoRn  
      Started by carnitron, Yesterday, 08:42 PM
      0 responses
      11 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Yesterday, 07:51 PM
      0 responses
      13 views
      0 likes
      Last Post strategist007  
      Started by StockTrader88, 03-06-2021, 08:58 AM
      44 responses
      3,983 views
      3 likes
      Last Post jhudas88  
      Working...
      X