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

OnBarUpdate BarsInProgress[1] Clarification++

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

    OnBarUpdate BarsInProgress[1] Clarification++

    Ninja's,

    Please reference this previous post regarding BarsInProgress OnBarUpdate: https://ninjatrader.com/support/foru...ad.php?t=43737

    Default Data series = 5 mins, secondary or first AddDataSeries = 1m

    If I do not specify the BarsInProgress it runs like this:

    OnBarUpdate() - 5 min .
    OnBarUpdate() - 1 min
    OnBarUpdate() - 1 min
    OnBarUpdate() - 1 min
    OnBarUpdate() - 1 min
    OnBarUpdate() - 1 min
    OnBarUpdate() - 5 min

    Question1: How would I not specify BarsInProgress?!? Is this correct code logic to not specify BarsInProgress? "if (BarsInProgress != 0)" ?

    Question 2:If I am using increment counters "x++" will the counters run and reset to zero at each OnBarUpdate listed above 5, 1, 1, 1, 1, 1, 5? (note: "private int x=0" is just above protected override void OnBarUpdate() in code.

    Very much appreciated,
    Blairski

    #2
    Hello Blairski,

    Not specifying which bars in progress means you wouldn't have any condition.

    That line of code would be completely removed.

    The code you have suggested 'if (BarsInProgress != 0)' would trigger the action for any series that is processing that is not the primary.

    Removing the condition all together would allow the logic to run for all series.


    Incrementing a variable without specifying which BarsInProgress would cause the variable to increment for all bars being updated.

    Below is a publicly available link to the help guide on BarsInProgress.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by WaleeTheRobot, 04-28-2024, 04:42 PM
    1 response
    20 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by burtoninlondon, Today, 10:13 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by ezrollin, 02-26-2022, 11:14 PM
    11 responses
    218 views
    0 likes
    Last Post kenz987
    by kenz987
     
    Started by Ticks_66, Today, 09:50 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by Aquila_Welokk, 04-29-2024, 01:14 PM
    1 response
    20 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X