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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    86 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    124 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    64 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    115 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X