Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Assigning an alert to a Drawing object programmatically

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

    Assigning an alert to a Drawing object programmatically

    Hi All,

    I have an self-made indicator that mark lines according to my code logic using the following code

    Code:
    Draw.HorizontalLine(this, "AutoLine:" + priceNow.ToString(), priceNow, Brushes.Aqua);
    Is there a way to programmatically assign an alert to this Object? The same way I would do on the Graph (right-click --> Alert...)

    Gracias!

    #2
    Hello MattDavid,

    Thank you for your post.

    You can certainly create alerts programmatically. Here's the section of our help guide on Alerts/Sharing:



    I'm assuming you'd want an alert based on whether the current price hits or crosses the lines you're creating, is that correct? In that case, you'd likely need to store a reference to the object in a variable and refer to that to grab the price it's set at, then compare the current price to that.

    Here is an example one of my colleagues created that creates an alert based on a horizontal line being drawn, publicly available on our User App Share:

    https://ninjatraderecosystem.com/use...d/price-alert/

    Please let us know if we may be of further assistance to you.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

    Comment


      #3
      Hello Kate,

      Thank you for your reply.

      I just have a look at the reference and the code example and that is not quite the functionality I am looking

      I would like to use the already built-in "Alerts" functionality of NT8, the one that can be seen in this screen -

      Click image for larger version

Name:	1.png
Views:	214
Size:	48.6 KB
ID:	1115826

      So that I will Draw an object and set an Alert (as If I was using in this screen) just programmatically


      Thank you for the help!

      Mat

      Comment


        #4
        Hello MattDavid,

        Thank you for your reply.

        There would not be a single method to draw an object and set an alert on that object at the same time programmatically. You would need to draw the object and then check the conditions based on that object in your code and then trigger the alert if those conditions are met, as in the examples previously provided. It is not possible to access the Alerts dialogue programmatically.

        Please let us know if we may be of further assistance to you.

        Comment


          #5
          Thank you for the help, that was my question

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          648 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          369 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          108 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          572 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          573 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X