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

Sound alert on new arrow

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

    Sound alert on new arrow

    Dear community,

    I have an indicator which produces arrows by some conditions. Now I want to have a sound alert on every arrow. I'm not allowed to edit this indicator so I have to write an indicator for sound messages on every new up/down arrow.

    Can someone guide me with the coding?

    Thanks in advance
    Max

    #2
    Hello,

    Thank you for the question.

    There are a couple of ways to do this and will depend on what you have access to in the indicator that plots the arrows.

    The easy way to accomplish this would be to use the same equation that is used in the indicator that draws the arrows. You could create a separate indicator that uses this logic to create sound instead of arrows.

    Being that the indicator is not editable this would probably not be an option.

    The second option would be to use the indicator that is not editable as a trigger.

    You can do this although it would require that the indicator that can not be edited exposes either a plot that is used in creating the arrows or some other value that indicates that there was a arrow created.

    One way to check this would be to do the following in an indicator.

    Type the name of the indicator that can not be edited followed by ( ) with any overloads that are needed and then a period. This will expand the intellisense and you can look through the list to see if there are any plots listed that are also listed in the indicators properties on the chart.

    This is a example of the above in code using the Stochastics indicator
    Code:
    Stochastics(Close, 10, 14, 2).K
    Notice after the parenthesis I have added the .K to access the K dataSeries of the Stochastics indicator, you can try something similar to see if there are any exposed variables or data series.

    If there is no exposed value for you to see in your second indicator there would be no signals to determine when an arrow is made.

    Please let me know if I may be of additional assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello,

      Thank you for the question.

      There are a couple of ways to do this and will depend on what you have access to in the indicator that plots the arrows.

      The easy way to accomplish this would be to use the same equation that is used in the indicator that draws the arrows. You could create a separate indicator that uses this logic to create sound instead of arrows.

      Being that the indicator is not editable this would probably not be an option.

      The second option would be to use the indicator that is not editable as a trigger.

      You can do this although it would require that the indicator that can not be edited exposes either a plot that is used in creating the arrows or some other value that indicates that there was a arrow created.

      One way to check this would be to do the following in an indicator.

      Type the name of the indicator that can not be edited followed by ( ) with any overloads that are needed and then a period. This will expand the intellisense and you can look through the list to see if there are any plots listed that are also listed in the indicators properties on the chart.

      This is a example of the above in code using the Stochastics indicator
      Code:
      Stochastics(Close, 10, 14, 2).K
      Notice after the parenthesis I have added the .K to access the K dataSeries of the Stochastics indicator, you can try something similar to see if there are any exposed variables or data series.

      If there is no exposed value for you to see in your second indicator there would be no signals to determine when an arrow is made.

      Please let me know if I may be of additional assistance.
      At first, thank you for your post.

      I tried to reach my indicator with

      Code:
      myIndicatorName(Parameters).K
      but that doesn't work. Isn't it possible to get all objects from the current candle and if it's an arrow, there has to be an alert?

      Comment


        #4
        Hello,

        Thank you for the reply.

        That would not work as I assume there is no "K" value in the indicator you are trying to access.

        The "K" is the plot name in the Stochastics indicator, if you were to load the Stochastics indicator on a chart and look in the properties in the plots section, you will find the K plot.

        Please try this to help narrow down what plots are available in the indicator you are working with.

        On a chart, load the indicator you are trying to access.
        In the indicators properties, look at the names of the plots that are available, also take note if the plots may have anything to do with when the arrows are generated.

        Now back in the indicator, replace the "K" with one of these plot names.

        If you are successful you can access the values of that plot and create logic based on that.

        It is unlikely that they have created the indicator to use a plot only for arrow locations but rather they are placing the arrows based on a calculation that is done using one of the plots in the indicator.

        More thank likely even if you are able to access the plots they use you will need to come up with some sort of equation to determine where to place the arrows or in your case where to fire off the sound alert.

        Please let me know if I may be of additional assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Yes, that's the problem. I don't trigger the .K value of my indicator. I just place the '.', but there is nothing I can choose to trigger. It seems that I can't trigger my indicator. It's also not listed withing the Edit Indicators list.

          So my question would be. Can I make an indicator which shows at the current candle and if there appears an arrow it will print an alert?

          Comment


            #6
            Hello,

            The "K" value was just meant to be an example in this case.

            As for your question : Can I make an indicator which shows at the current candle and if there appears an arrow it will print an alert?

            Can you elaborate more on this I am not sure I understand what you are trying to do.
            I understand that you want this to be on the current bar but what causes the arrow to draw and alert?

            You can certainly create a indicator that alerts you based on conditions based on the data on the chart.

            If you would like to email me at platformsupport @ ninjatrader.com and refernce the address to this page in the body, we can set up a remote asssitance call so that I can better see what you are trying to do and help explain the editor a little better.


            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Originally posted by arroganzmaschine View Post
              At first, thank you for your post.

              I tried to reach my indicator with

              Code:
              myIndicatorName(Parameters).K
              but that doesn't work. Isn't it possible to get all objects from the current candle and if it's an arrow, there has to be an alert?
              Once a DrawObject appears on a chart, that object is one of the DrawObjects collection, so you can query that collection and take any action that you want based on the addition of that new DrawObject. There is more than one way to query if a new object has appeared, so that you can start processing said new object. The quickest that comes to mind are to see if the DrawObjects.Count has increased on that bar. That means that you have to keep a record of the current count, to be compared to the count on the new bar.

              There are some very focused examples in the literature. Study them for ideas.

              ref: http://www.ninjatrader.com/support/h...rawobjects.htm

              Comment


                #8
                Originally posted by koganam View Post
                Once a DrawObject appears on a chart, that object is one of the DrawObjects collection, so you can query that collection and take any action that you want based on the addition of that new DrawObject. There is more than one way to query if a new object has appeared, so that you can start processing said new object. The quickest that comes to mind are to see if the DrawObjects.Count has increased on that bar. That means that you have to keep a record of the current count, to be compared to the count on the new bar.

                There are some very focused examples in the literature. Study them for ideas.

                ref: http://www.ninjatrader.com/support/h...rawobjects.htm
                That seems to be a good idea. I will try this one out. So I have a temp variable which contains the current DrawObjects.Count. At OnBarUpdate I have to check if it increased and then play an alert. How can I play an alert?

                Comment


                  #9
                  Originally posted by arroganzmaschine View Post
                  That seems to be a good idea. I will try this one out. So I have a temp variable which contains the current DrawObjects.Count. At OnBarUpdate I have to check if it increased and then play an alert. How can I play an alert?
                  Not quite so simple. You will have to check that the newly added DrawObject is the type that you are querying, then act on that.

                  You use the Alert() method to raise an alert. You can also use PlaySound(), or indeed any C# method that you may choose.

                  ref: http://www.ninjatrader.com/support/h.../nt7/alert.htm
                  Last edited by koganam; 09-04-2014, 10:20 AM.

                  Comment


                    #10
                    That's weird. I want to detect every new drawing on the chart. When I draw them on my own, I get an alert. If the indicator draws them, nothing happens.

                    Any suggestions?

                    Comment


                      #11
                      Originally posted by arroganzmaschine View Post
                      That's weird. I want to detect every new drawing on the chart. When I draw them on my own, I get an alert. If the indicator draws them, nothing happens.

                      Any suggestions?
                      You will have to examine the way that you are processing the object counts. It seems that your code may be processing the count in a manner where it sees the indicator's updated count too early.
                      Last edited by koganam; 09-06-2014, 11:45 AM.

                      Comment


                        #12
                        Originally posted by koganam View Post
                        You will have to examine the way that you are processing the object counts. It seems that your code may be updating the processing the count in a manner where it sees the indicators updated count too early.
                        I just count every object on the chart with
                        Code:
                        DrawObjects.Count
                        So I thought it will also count the objects from the indicator and not just my own drawings.

                        Comment


                          #13
                          Originally posted by arroganzmaschine View Post
                          I just count every object on the chart with
                          Code:
                          DrawObjects.Count
                          So I thought it will also count the objects from the indicator and not just my own drawings.
                          That is a single expression that gets the count of the objects. It does not say anything about how you are processing the change in count, or whatever else you are doing. That expression will return the count all the draw objects, period, no matter how they are drawn.

                          Use a Print() statement after you call the count, and you can see it increase every time a new draw object appears.

                          If you are not getting a response from the appearance of a new draw object, it is because your code is not processing the way that you want it do: it most assuredly is processing they way that you have instructed it to do. Bring your code into alignment with your intent.
                          Last edited by koganam; 09-06-2014, 11:49 AM. Reason: Corrected programming syntax.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by funk10101, Today, 09:43 PM
                          0 responses
                          6 views
                          0 likes
                          Last Post funk10101  
                          Started by pkefal, 04-11-2024, 07:39 AM
                          11 responses
                          37 views
                          0 likes
                          Last Post jeronymite  
                          Started by bill2023, Yesterday, 08:51 AM
                          8 responses
                          44 views
                          0 likes
                          Last Post bill2023  
                          Started by yertle, Today, 08:38 AM
                          6 responses
                          26 views
                          0 likes
                          Last Post ryjoga
                          by ryjoga
                           
                          Started by algospoke, Yesterday, 06:40 PM
                          2 responses
                          24 views
                          0 likes
                          Last Post algospoke  
                          Working...
                          X