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

Comparing bar lows/highs

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

    Comparing bar lows/highs

    I would like to compare the lows/highs of previous bars, but have no idea how to accomplish this. So say the Low[9] was 700 and Low[0] is 705. What code could be written to compare those numbers and recognize that the Low[0] was higher than Low[9]?
    Any help would be greatly appreciated.

    #2
    Hello,

    Thanks for the forum post.

    To check these two bars I would check this.

    if (Low[0] >= Low[9])
    {

    //Do something since the Low[0] is greater then or equal to the Low of 9 bars back.

    }


    If you dont know what bar you want to compare you can use this indicator to do this as well.



    if(Low[0] > MIN(9)[0])
    {
    // The current low is greater then all the lows of the last 9 bars if this check is successfull

    }

    Let me know if I can be of further assistance.

    Comment


      #3
      Thanks for the reply Brett. Great solution. Your second suggestion is along the lines of what I was looking for. I'm trying to find specific lows/highs that deal with the RValueCharts indicator. Specifically when (RValueCharts(Color.Blue, 3, 3).VClose[0] <= -4 ) or (RValueCharts(Color.Blue, 3, 3).VClose[0] >= 4 ) So when the RValueCharts VClose is +/- 4 I would like to know what the Low/High of that bar is and then be able to compare that to future bars. Your suggestion is wonderful. Could you give me an example of how to combine these two ideas? Thanks.

      Comment


        #4
        if(Low[0] > MIN(RValueCharts(Color.Blue, 3, 3).VClose[0], 9)[0])
        {
        // The current low is greater then all the lows of the last 9 bars if this check is successfull

        }

        The above should do the trick. Min will work with your custom indicators as well.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        26 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, Yesterday, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        192 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,234 views
        0 likes
        Last Post xiinteractive  
        Working...
        X