Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Code: BarsInProgress/BarsRequired

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

    Code: BarsInProgress/BarsRequired

    I would appreciate some help to sort out my confusions concerning a section in NT's Help menu (Ninja Script Educational Resources, Tips, MultiTime Frame&Instruments) and would appreciate going step by step rather than all at once.

    What is the difference between

    if(BarsInProgress != 0)
    and
    if(BarsInProgress == 0)

    What does one do which the other one does not? Or, why/when would I use one and not the other one?

    (Am I correct to say that the "0" here refers to the primary data series, the primary Bars Object on which chart I will later load this indicator?)

    CurrentBars[0] < BarsRequired
    and
    CurrentBars[0] <= BarsRequired

    What does one do which the other one does not? Or, why/when would I want to use one and not the other one? (And same here concerning the "0" - it refers to the primary BarsObject/Primary Data Series, correct?)

    sandman

    #2
    Hello sandman,
    Thanks for your post.

    Code:
    if(BarsInProgress == 0)  //EQUALS
    The above code checks for the primary bar series only.

    Code:
    if(BarsInProgress != 0)  //NOT EQUALS
    The following however checks for bar series other than the primary series. Thus say you have 3 bar series (5 minute primary, 1 minute 1st secondary series and 30 minute 2nd secondary series) then the code will filter out (not evaluate) the primary series.

    "<" represents the less than while "<=" represents less than equal to.

    Please refer to the msdn page which further discusses on various C# operators.




    What you will use will depend on your coding logic.
    JoydeepNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    579 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X