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 rhyminkevin, Today, 04:58 PM
      4 responses
      52 views
      0 likes
      Last Post dp8282
      by dp8282
       
      Started by iceman2018, Today, 05:07 PM
      0 responses
      5 views
      0 likes
      Last Post iceman2018  
      Started by lightsun47, Today, 03:51 PM
      0 responses
      7 views
      0 likes
      Last Post lightsun47  
      Started by 00nevest, Today, 02:27 PM
      1 response
      14 views
      0 likes
      Last Post 00nevest  
      Started by futtrader, 04-21-2024, 01:50 AM
      4 responses
      50 views
      0 likes
      Last Post futtrader  
      Working...
      X