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.

    http://msdn.microsoft.com/en-us/library/ms173145.aspx


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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by IndieTrader, Today, 05:29 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by ballboy11, Today, 08:09 AM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by kempotrader, 05-03-2019, 10:52 AM
    8 responses
    89 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by waldoalvarez, Today, 07:53 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by sinpeople, 03-05-2021, 09:53 AM
    3 responses
    25 views
    0 likes
    Last Post NinjaTrader_ThomasC  
    Working...
    X