Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Only start calculating if xBars are loaded

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

    Only start calculating if xBars are loaded

    Hi,
    how can i define a code section that gets only excecutet if x Bars are loaded?
    Thanks for your help
    F.S

    #2
    Hello FelixMMM,

    Thanks for posting.

    This may be done using by using CurrentBar to check the bar in a Bars object that the OnBarUpdate() method is currently processing. The following example from the Help guide demonstrates this:

    if (CurrentBar < 20)
    return;

    I've provided a link below to the relevant section of the Help guide:

    https://ninjatrader.com/support/help...currentbar.htm

    In a multi-instrument or multi-time frame script, currentBars may be used to access the CurrentBar of all Bars objects:

    https://ninjatrader.com/support/help...urrentbars.htm

    Please let me know if I may be of further assistance.
    Last edited by NinjaTrader_Tyler; 01-01-2020, 01:02 PM.
    Tyler M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    68 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    151 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    100 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    288 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X