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

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.

    Learn the C# operators and expressions, operator precedence, and operator associativity.



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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by algospoke, Today, 06:40 PM
    0 responses
    4 views
    0 likes
    Last Post algospoke  
    Started by maybeimnotrader, Today, 05:46 PM
    0 responses
    7 views
    0 likes
    Last Post maybeimnotrader  
    Started by quantismo, Today, 05:13 PM
    0 responses
    6 views
    0 likes
    Last Post quantismo  
    Started by AttiM, 02-14-2024, 05:20 PM
    8 responses
    168 views
    0 likes
    Last Post jeronymite  
    Started by cre8able, Today, 04:22 PM
    0 responses
    9 views
    0 likes
    Last Post cre8able  
    Working...
    X