Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.GetBars Method

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

    Bars.GetBars Method

    Hi,

    I'm trying to use the undocumented Bars.GetBars method to backfill historical ticks. I had it working in NT7.

    Currently my example code in 8 looks like this and the code runs, but does not really produce results.

    Code:
       BarsPeriod bpAsk = new BarsPeriod();
                    bpAsk.BarsPeriodType = BarsPeriodType.Tick;
                    bpAsk.MarketDataType = MarketDataType.Ask;
                    bpAsk.Value = 1;
                    bpAsk.BaseBarsPeriodValue = 1;
    
    
                    
    
                    Bars.GetBars(dBars.Instrument, bpAsk, this.beginTime, this.toTime, bars.TradingHours,
                       bars.IsDividendAdjusted, bars.IsSplitAdjusted, bars.IsTickReplay, bars.IsResetOnNewTradingDay,
                       LookupPolicies.Provider, MergePolicy.UseGlobalSettings, true, null, AdBars.IsRolloverAdjusted, null, GetBarsCallBack());
    And the Callback method...Any help appreciated on how to use this, currently I just make it return null so that it compiles and runs.

    Code:
      private Action<Bars, ErrorCode, string, object> GetBarsCallBack()
            {
                return null;
            }
    Thanks a lot.

    #2
    Hello Serialcoder,

    Thanks for your post and welcome to the Ninjatrader forums!

    Correct, in NinjaTrader 7 it is undocumented.

    In Ninjatrader 8 you would want to use BarsRequest which is documented. Please see: http://ninjatrader.com/support/helpG...arsrequest.htm

    (Note that while the link shows in the Helpguides's Add On area, the comment in the example advises: "...The concept can be carried over to any NinjaScript object you may be working on."

    Comment


      #3
      Thank you for the quick reply.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      45 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      30 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      99 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      177 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      170 views
      0 likes
      Last Post CarlTrading  
      Working...
      X