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

Condition For Multiple Bars

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

    Condition For Multiple Bars

    I want to program a condition that is true for multiple bars. Barsago doesn't seem to reference all the bars. E.g. Is there a way to code "condtion true for all of the last 5 bars?

    #2
    Matts, you could either works with loops or for example our CountIf method for this task - http://www.ninjatrader-support.com/H...6/CountIf.html
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Why wouldn't the [int barsAgo] parameter work in Boolean logic using conditional statements? Like this:


      High[0] > High[1] &&
      High[1] > High[2] &&
      High[3] > High[4];

      Comment


        #4
        This would work as well, however you want to take care to have a high enough CurrentBar's check then present at the OnBarUpdate() start -

        BertrandNinjaTrader Customer Service

        Comment


          #5
          I used CountIf, which works perfectly. Thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          43 views
          0 likes
          Last Post jeronymite  
          Started by frankthearm, Today, 09:08 AM
          4 responses
          10 views
          0 likes
          Last Post frankthearm  
          Started by yertle, Today, 08:38 AM
          5 responses
          15 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by adeelshahzad, Today, 03:54 AM
          3 responses
          18 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by bill2023, Yesterday, 08:51 AM
          6 responses
          27 views
          0 likes
          Last Post NinjaTrader_Erick  
          Working...
          X