Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Comparing Price of last bar

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

    Comparing Price of last bar

    Hello,
    Is there a function that compares the high of the last bar with high of the preseding 20 bars excluding the last bar, i.e bar [1].

    THANKS

    #2
    Segale, to get the maximum value within the last 20 bars, you can use the MAX() function and get the value from one bar back (essentially excluding the most current bar), and then compare this value however you want.
    Code:
    double highestHighInLastTwentyBars = MAX(High, 20)[1];
    double mostRecentHigh = High[0]
    
    if (mostRecentHigh > highestHighInLastTwentyBars)
        // do something
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thanks Austin, wow the replies here are really fast and dont blabber on about folk not doing their homework before asking. One of the the frustrations of programming is that you can do a lot of looking in all the wrong places. Thanks again.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, Yesterday, 10:06 AM
      0 responses
      14 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      11 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      9 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      4 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      31 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X