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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    80 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    63 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X