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