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

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.
    Kate W.NinjaTrader Customer Service

    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:	177
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.
        Kate W.NinjaTrader Customer Service

        Comment


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

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by OllieFeraher, 05-09-2024, 11:14 AM
          5 responses
          16 views
          0 likes
          Last Post MisterTee  
          Started by jackiegils, Yesterday, 11:05 PM
          1 response
          9 views
          0 likes
          Last Post marcus2300  
          Started by Skifree, Today, 02:50 PM
          0 responses
          8 views
          0 likes
          Last Post Skifree
          by Skifree
           
          Started by owen5819, Today, 02:24 PM
          1 response
          10 views
          0 likes
          Last Post owen5819  
          Started by Skifree, 05-07-2024, 11:38 PM
          2 responses
          28 views
          1 like
          Last Post Skifree
          by Skifree
           
          Working...
          X