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 GussJ, 03-04-2020, 03:11 PM
      11 responses
      3,229 views
      0 likes
      Last Post xiinteractive  
      Started by andrewtrades, Today, 04:57 PM
      1 response
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      7 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      441 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      12 views
      0 likes
      Last Post FAQtrader  
      Working...
      X