Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 llanqui, Today, 11:10 AM
    0 responses
    4 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by llanqui, Today, 10:29 AM
    0 responses
    5 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by llanqui, Today, 08:32 AM
    1 response
    11 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by lollers, Yesterday, 03:26 AM
    1 response
    53 views
    0 likes
    Last Post lollers
    by lollers
     
    Started by Salahinho99, 05-05-2024, 04:13 AM
    7 responses
    63 views
    0 likes
    Last Post Salahinho99  
    Working...
    X