Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 jeronymite, 04-12-2024, 04:26 PM
        3 responses
        40 views
        0 likes
        Last Post jeronymite  
        Started by bill2023, Today, 08:51 AM
        2 responses
        16 views
        0 likes
        Last Post bill2023  
        Started by sidlercom80, 10-28-2023, 08:49 AM
        167 responses
        2,260 views
        0 likes
        Last Post jeronymite  
        Started by warreng86, 11-10-2020, 02:04 PM
        7 responses
        1,362 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Perr0Grande, Today, 08:16 PM
        0 responses
        5 views
        0 likes
        Last Post Perr0Grande  
        Working...
        X