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

Making an Audio Alerts indicator?

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

    Making an Audio Alerts indicator?

    Hi.

    I have had Audio Alerts disappear mysteriously, and then I have to add them back in. I'm trading and later on they disappear again.
    That and the fact that you can't save Audio Alert Templates in Ninjatrader ‍♂️

    So I'm asking for advice on how to make an indicator for one job - audio alerts.
    How do I access existing indicators in another indicator and setup alerts within it?

    This would be the perfect solution as all I'd have to do is load up the indicator on any chart that I want the alerts on.
    It would save endless hours. Any and all advice would be very much appreciated.

    Thank you!

    #2
    Helllo davydhnz,

    To make alerts you can call Alert or PlaySound:





    To access other indicators you can call them by name, for example the sma would look like the following to get its current bar value:

    Code:
    double smaPrice = SMA(12)[0];
    One way to do this would be to use the strategy builder to generate conditions for alerts and then click View Code in the builder. You can see the resulting indicator code and conditions which you can copy into your indicator to be used.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks Jesse for your reply,

      Just a follow up. When you wrote "double smaPrice = SMA(12)[0];" Can you do the same for third party indicators or custom indicators you write from scratch?

      The other thing is how do you control how frequently the sound is triggered? With audio alerts you can choose, till condition reverses, or bar close, or every 30 seconds.

      What I've always wanted is the first trigger within a bar, and no more until the next bar, but I have no idea how to do that.

      Thanks!

      Comment


        #4
        Helllo davydhnz,

        Yes its the same process to call any indicator you have installed, they will just have different parameters. The easiest way to find out code for third party indicators is to use the steps with the strategy builder that I had mentioned.

        Because you are making your own script you would need to implement the frequency for the sounds by limiting how frequently you call that method. That can be done by making conditions, for example if an SMA crossed another SMA you could trigger an alert. That would happen once each time the crossing happened but not on every bar because the alert is constrained by the condition.

        If you only wanted 1 alert per bar and if we assume your script is using Calculate.OnaBarClose all you need to do is make any kind of condition, as long as that condition only becomes true at the time of some specific event the sound will only happen once per bar.



        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by gravdigaz6, Yesterday, 11:40 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by MarianApalaghiei, Yesterday, 10:49 PM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by XXtrader, Yesterday, 11:30 PM
        0 responses
        4 views
        0 likes
        Last Post XXtrader  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Yesterday, 09:43 PM
        0 responses
        9 views
        0 likes
        Last Post funk10101  
        Working...
        X