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 in an indicator

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

    Alert in an indicator

    Hi,

    I can't produce a simple alert in my indicator. Alert window is open. The alert statement in the code is definitely executed, because next statements are Print and DrawTextFixed which work fine.

    The alert itself is quite simplified:

    Alert("Alert0", NinjaTrader.Cbi.Priority.High, "Reached threshold", "", 10, Color.Black, Color.Yellow);

    Where should I look? What are typical errors about alerts? Can I call an Alert() in a indicator?

    #2
    Hello fel17,
    The alert function is a real time function only. It wont trigger on historical bars or if you are disconnected.


    I can run the code at my end. Please see the attached screenshot where I could get 3 alerts.

    Please let me know if I can assist you any further.
    Attached Files
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Hello Joydeep,

      I tried with a simplest indicator, OnBarUpdate contains only Alert(). Works fine.

      If I put this statement in the existing code with some logic: it doesn't work. On the same chart. I'm sure it's executed, because Print() and DrawText() are called directly after Alert().

      Everything is connected. I also call historical data in this indi, but after Alert(). And I want only to alert for current data.

      Even put as the first statement OnBarUpdate() - no reaction in the alerts window.

      Any other idea?

      Comment


        #4
        Edit: It seems to work, at least in simplest form. But alert needs a lot of time to appear. Print() output appears immediately, Alert() called earlier - couple of minutes later.

        I try to build the statement in the full logic now...

        Comment


          #5
          How often are you calling this alert? Alerts have a reset time that has to clear before it can sound again.

          -Brett

          Comment


            #6
            I call it in OnBarUpdate() once. I played with CalculateOnBarClose, but can't see a regularity.
            I get an alert if I put Alert() quite early in OnBarClose(). But if I move this statement to the end I don't receive this alert.

            It seems to depend on some things, parameters but I can't recognize which things are relevant. What is important for an alert?

            Reset time in my case is 10 sec. or not?

            Comment


              #7
              Hello fel17,
              Yes, reset time in your case is 10 second.

              If CalculateOnBarClose is set to true then the alters will trigger only at the end of the bar.

              Can you send a toy code* to support[AT]ninjatrader[DOT]com depicting the behavior.

              Please append Attn:Joydeep in the subject line of the email and please give a reference of this thread in the body of the email.

              I look forward to assisting you further.

              *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
              JoydeepNinjaTrader Customer Service

              Comment


                #8
                Joydeep, I've sent you a mail. Please read it today, because today is the alert day for some futures

                Comment


                  #9
                  Hello fel17,
                  This is to confirm I have received your code and will be replying to your email shortly.
                  JoydeepNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by bortz, 11-06-2023, 08:04 AM
                  47 responses
                  1,602 views
                  0 likes
                  Last Post aligator  
                  Started by jaybedreamin, Today, 05:56 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post jaybedreamin  
                  Started by DJ888, 04-16-2024, 06:09 PM
                  6 responses
                  18 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by Jon17, Today, 04:33 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post Jon17
                  by Jon17
                   
                  Started by Javierw.ok, Today, 04:12 PM
                  0 responses
                  12 views
                  0 likes
                  Last Post Javierw.ok  
                  Working...
                  X