• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Alert only triggered once per Bar

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

    Alert only triggered once per Bar

    Hi,

    I've developed an alert that's triggered while a bar is still in progress (CalculateOnBarClose = false), but if it is triggered I want to make sure it can't be triggered again within the same bar. How can this be achieved?

    Thanks

    #2
    Hello laocoon,

    Thanks for your post.

    You can check to see if the current bar is the same bar as the alert was issued on. For example assume you create a private int alertBar and then save the CurrentBar into it when you set the alert:

    if (your alert conditions && CurrentBar != alertBar)
    {
    Alert(...);
    alertBar = CurrentBar; // save the current bar on the first time through
    }


    So in the example if the current bar is not equal to the alertBar then the alert will sound and the current bar number will be saved into alertBar, on the next tick(s) the alert will not be issued until a new bar is opened and CurrentBar changes.

    Reference: https://ninjatrader.com/support/help...currentbar.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Perfect, thanks so much Paul!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by uiwislth, Yesterday, 11:25 PM
      0 responses
      4 views
      0 likes
      Last Post uiwislth  
      Started by Steve L, Yesterday, 10:04 PM
      0 responses
      3 views
      0 likes
      Last Post Steve L
      by Steve L
       
      Started by marianfed, Yesterday, 09:47 PM
      0 responses
      4 views
      0 likes
      Last Post marianfed  
      Started by hir04068, Yesterday, 09:29 PM
      0 responses
      2 views
      0 likes
      Last Post hir04068  
      Started by iq200, 03-11-2018, 07:49 PM
      24 responses
      1,017 views
      0 likes
      Last Post mrlucky1x  
      Working...
      X