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 argusthome, Yesterday, 10:06 AM
    0 responses
    17 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    16 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    14 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    9 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    38 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X