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 Max238, Today, 01:28 AM
      1 response
      21 views
      0 likes
      Last Post CactusMan  
      Started by giulyko00, Yesterday, 12:03 PM
      2 responses
      10 views
      0 likes
      Last Post giulyko00  
      Started by r68cervera, Today, 05:29 AM
      0 responses
      4 views
      0 likes
      Last Post r68cervera  
      Started by geddyisodin, Today, 05:20 AM
      0 responses
      6 views
      0 likes
      Last Post geddyisodin  
      Started by JonesJoker, 04-22-2024, 12:23 PM
      6 responses
      37 views
      0 likes
      Last Post JonesJoker  
      Working...
      X