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

  • NinjaTrader_Joydeep
    replied
    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.

    Leave a comment:


  • sandman
    started a topic Code: BarsInProgress/BarsRequired

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by Taddypole, Today, 02:47 PM
0 responses
0 views
0 likes
Last Post Taddypole  
Started by chbruno, 04-24-2024, 04:10 PM
4 responses
50 views
0 likes
Last Post chbruno
by chbruno
 
Started by TraderG23, 12-08-2023, 07:56 AM
10 responses
398 views
1 like
Last Post beobast
by beobast
 
Started by lorem, Yesterday, 09:18 AM
5 responses
22 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by WHICKED, Today, 12:56 PM
2 responses
15 views
0 likes
Last Post WHICKED
by WHICKED
 
Working...
X