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

Lows great then an indicator

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

    Lows great then an indicator

    What would be an effective way of checking if Bar Lows are above a Pivot (or other indicator) for x number of bars. Would countif do it, the problem then would be how would i define the look back period.

    What im looking to do is, if low is above Pivot for a user definable number of bars, do something.

    #2
    GKhonheiser,

    You can create a User Defined Input variable for the look back period that you can change when you are setting the scripts' parameters in the chart.

    Below is a reference sample of to create User Defined Input parameters -
    http://www.ninjatrader.com/support/f...ead.php?t=5782
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Hi Cal,

      I am familiar with creating the user definable input. Its the logic that is the issue. If i wanted to have two Lows above the the pivot I would need if(Low[0] > pp && Low[1] > pp), if I wanted 3 lows higher then i would have if(Low[0] > pp && Low[1] > pp && Low[2] > pp), but im looking for a more effective way of checking for this. ie If the user input is 5 then check that the last 5 lows are above PP?

      Does that make sense?

      Thanks

      Comment


        #4
        GKonheiser,

        You can create a for loop that you can then use to test your calculation out against the user defined input.

        Example -
        Code:
        int x = 10; // user defined input
        
        for( int i = 0; i < x; i++)
        {
             if(Low[i] > pp)
             {
                  //do something
             }
        
             else
             break;
        }
        Let me know if this helps
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cre8able, Today, 03:20 PM
        0 responses
        5 views
        0 likes
        Last Post cre8able  
        Started by Fran888, 02-16-2024, 10:48 AM
        3 responses
        47 views
        0 likes
        Last Post Sam2515
        by Sam2515
         
        Started by martin70, 03-24-2023, 04:58 AM
        15 responses
        114 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by The_Sec, Today, 02:29 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by jeronymite, 04-12-2024, 04:26 PM
        2 responses
        31 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X