Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding alerts to indicator drawing

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

    Adding alerts to indicator drawing

    hello

    I have an indiicator that prints certain drawing objects - arrow etc when certain things occur
    i would like to add a visual screen flash and audio alert when these drawings appear

    can i paste the code here?

    Thankyou in advance

    #2
    Heres the code

    VALID HL APRIL 25.txt

    Comment


      #3
      Hello NISNOS69,

      It is possible to send an Alert to the Alerts Log window with a sound with the Alert() method.
      Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


      As far as flashing the screen, you could change the ChartControl.Properties.ChartBackground brush or you could open a new window.
      Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thankyou

        Where abouts in the code would I insert it?

        Thankyou

        Also how would I specify it on a candle close?
        Thankyou

        Comment


          #5
          Hello NISNOS69,

          If you are wanting to call Alert() when a drawing tool method is called, you can call the Alert() method one line above or one line below the Draw method.

          The script updates OnBarUpdate based on the Calculate setting. When set to OnBarClose, the logic is evaluated when the bar closes. When set to OnPriceChange or OnEachTick this will update before the bar closes. With these, require IsFirstTickOfBar to be true to trigger an action after a bar has closed.
          Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


          I am also including a link to a support article with helpful resources on getting started with C# and NinjaScript.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            thankyou -

            Within this section of code?

            Code:
            {
                        int num1 = this.LowestBarFromRange(startIndex, barIndex);
                        this.bearishLows.Add(num1);
                        this.validHighs.Add(startIndex);
                        this.lowestLow = Low.GetValueAt(num1);
                        if(this.DebugMode) Print(string.Format("Yes, validated high @{0}", startIndex));
                        if(this.DebugMode) Print(string.Format("Resetting lowest low to {0}", this.lowestLow));
                        int num2 = this.HighestBarFromRange(this.validLows.LastOrDefault<int>(), barIndex);
                        int num3 = this.MarkSwingPeaks ? num2 : startIndex;
                        this.swingHighs.Add(num3);
                        if (this.ShowFractals)
                            Draw.ArrowDown(this, "valid-high-" + barIndex.ToString(), true, CurrentBar - num3, High.GetValueAt(num3) + (15 * TickSize), this.ValidHighColor);
                        if (!this.ShowSwings)
                          return;​
            I want the audio alert when the "arrow down" is drawn

            thankyou in advance

            Comment


              #7
              Hello NISNOS69,

              If the Draw.ArrowDown() call is the object in question, this is in a single statement block (no curly braces) and you would want to add curly braces for a multi-statement block and add the call to Alert() within the block.
              Code:
              if (this.ShowFractals)
              {
              Alert("myAlert", Priority.Low, "My Alert", NinjaTrader.Core.Globals.InstallDir+"\\sounds\\Alert1.wav", 10, Brushes.Black, Brushes.Yellow);
              Draw.ArrowDown(this, "valid-high-" + barIndex.ToString(), true, CurrentBar - num3, High.GetValueAt(num3) + (15 * TickSize), this.ValidHighColor);​
              }
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                NinjaTrader_ChelseaB

                APOLOGIES FOR THE DELAY -

                Thankyou - that helped me lots!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                630 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                364 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                105 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                565 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                568 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X