• 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 Not Firing as Expected

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

    Alert Not Firing as Expected

    This is a mod of the HMA Colour Change indie to add an alert function on a reversal. The logic I added tests for two bars going in one direction, followed by one bar in the opposite direction. This is my definition of a reversal.

    The indicator works only occasionally. Many reversals occur without the alert being triggered, and I can't figure out why. So that's the first request: is there something faulty in the logic I coded?

    Second, is there a better way to test for a reversal?

    Third, does the Rearm parameter possibly prevent the alert from firing if, for example, YM reverses shortly after NQ reverses, within the time value of the Rearm parameter? I have this set to 5 seconds, but most reversals are just not triggering the alert, regardless of the Rearm timing.

    Thanks in advance!
    Attached Files

    #2
    Hello gdstuart,

    Thanks for opening the thread!

    I do not see anything faulty with the code with a first glance. The next step for troubleshooting would involve adding prints to the indicator logic to check if the logic is recognizing reversals appropriately when you think it should.

    The ReArm time does exactly as you have described. If another alert fires sooner than the number of ReArm seconds after the last alert fire, the alert will be ignored.

    I have included some publicly available information that should provide assistance in debugging the indicator logic and writing an Alert() statement with the correct syntax.

    Debugging Tips - https://ninjatrader.com/support/foru...ead.php?t=3418

    Alert() - https://ninjatrader.com/support/help.../nt7/alert.htm

    As for detecting reversals, another member of the forums may have some other logical advise, but I think your approach of comparing the current and 2 bars back to look for a pivot or change in direction is adequate.

    If you have any additional questions on the results you are receiving, please don't hesitate to write back.
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jim View Post
      Hello gdstuart,

      The ReArm time does exactly as you have described. If another alert fires sooner than the number of ReArm seconds after the last alert fire, the alert will be ignored.
      Jim,

      What if an alert fires on NQ, and three seconds later YM triggers an alert, which is not out of the question where instruments are correlated. Will the YM alert fire or be disregarded? You see, I don't know whether the Rearm parameter is specific to a given instrument, or across multiple instruments which are all using this indie in their charts.

      I figured out my error. Many moving parts but now the basics are working.

      Thanks.

      Comment


        #4
        Hello gdstuart,

        Thanks for your question.

        Alert id's will always be unique between different instances. You can test this by creating a sample indicator that submits an alert on every bar close that has a rearm period of 60 seconds. This indicator can then be added to two charts with a 10 second series. When you open an Alert window, you will see that each Alert is 60 seconds apart for each instrument we applied the indicator to.

        Code:
        protected override void OnBarUpdate()
        {
            Alert("myAlert", NinjaTrader.Cbi.Priority.High, "Reached threshold", "Alert1.wav", 60, Color.Black, Color.Yellow);
        }


        In the image above, each alert fires >60 seconds after the previous alert on that instrument. Alerts on separate instruments can fire within this gap.

        Please let me know if I can be of further help.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Ilpropio, Today, 09:45 PM
        0 responses
        2 views
        0 likes
        Last Post Ilpropio  
        Started by Revan, Today, 05:44 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_Marco  
        Started by superg3, Today, 07:57 PM
        0 responses
        3 views
        0 likes
        Last Post superg3
        by superg3
         
        Started by Longhornmark, Today, 07:06 AM
        5 responses
        35 views
        0 likes
        Last Post nkhoi
        by nkhoi
         
        Started by bomberone3, Today, 02:59 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_ChrisL  
        Working...
        X