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 judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      59 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      36 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      7 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      21 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      10 views
      0 likes
      Last Post cre8able  
      Working...
      X