Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

high of the most recent bars

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

    high of the most recent bars

    If I understand correctly, High[0] would refer to the high of the most recent bar (the one that just closed). So, High[-1] should get the the high of the second most recent bar, right?
    I am trying to see if the most recent two bars have the same high while the current bar is not closed yet. But, when I use statements like the following,

    if( (High[0]==High[-1])){
    PlaySound(@"C:\Windows\media\notify.wav");
    }

    the sound is played after the most recent bar is closed and the current bar is still going (not closed). And, in those cases, the current bar and the most recent bar still close with the same high. Any thoughts on why it would do that? Or how could I correctly code to achieve the desired results?

    Thanks.

    #2
    gotet0,

    High[0] would be the most recent bar correct - however High[-1] does not exist.

    To get the second most recent bar you would use High[2].

    Please see our Tip on Using [] brackets:

    MatthewNinjaTrader Product Management

    Comment


      #3
      Thanks!

      Originally posted by NinjaTrader_Matthew View Post
      gotet0,

      High[0] would be the most recent bar correct - however High[-1] does not exist.

      To get the second most recent bar you would use High[2].

      Please see our Tip on Using [] brackets:

      http://www.ninjatrader.com/support/f...ad.php?t=19346

      Thanks for the quick reply!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      117 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      164 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      85 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      130 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      88 views
      0 likes
      Last Post PaulMohn  
      Working...
      X