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 Alerts Triggered at same Time

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

    Sound Alerts Triggered at same Time

    Hi Guys. I have had an annoying problem with sound alerts for quite some time and would be grateful for some help. Basically I trade multiple instruments and sound alerts are critical. Here is a snippet of the code:

    PHP Code:
    if (FirstTickOfBarboolAlertSounded false;    

    if (!
    boolAlertSounded)
                            
                        if (
    Instrument.MasterInstrument.Name == "6E"){PlaySound("6elongdivergence.wav");}
                        else if (
    Instrument.MasterInstrument.Name == "CL"){PlaySound("cllongdivergence.wav");}
                        else if (
    Instrument.MasterInstrument.Name == 
                        
    boolAlertSounded true
    The problem with this is if 3 instruments trigger at once on the first tick of the bar I only hear one alert because only one can be heard at a time. The only way around this I see is adding some sort of timer eg:

    if (Instrument.MasterInstrument.Name == "6E")

    SET TIMER TO WAIT 5 SECONDS

    {PlaySound("6elongdivergence.wav");}

    else if (Instrument.MasterInstrument.Name == "CL")

    SET TIMER TO WAIT 10 SECONDS

    {PlaySound("cllongdivergence.wav");}


    boolAlertSounded = true;

    Any ideas how to achieve this?

    Thanks in advance
    DJ

    #2
    djkiwi,

    Why not use the Alert() method? It has a cooldown timer, and also outputs more information to the Alert Window. It can play a sound as well.

    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Sound Alert

      Hi Adam, I thought you might say that . Actually I used to use that before but the problem was it would go off every 60 seconds or so. Say a 10 Renko bar may sit there for 30 minutes. If I set it for 30 minutes then there were 5 bars in 30 minutes how would that work?

      Basically l like the firsttickofbar concept but I'm not sure how the Alert could be used with that because it would still trigger at the first tick of bar irrespective of the Alert timer set? Am I understanding this correctly?

      Thanks
      DJ

      Comment


        #4
        djkiwi,

        If you used the first tick of bar criteria it would only call the alert once at the first tick of each bar as long as the other conditions were true, however may call it for more than one instrument.

        The alert would be easiest to remedy your sound issue, as it would allow some cooldown if you gave it the same alert name between instruments. It would also let you see if for example 3 instruments had the alert when you only heard the sound once. You could also print to the output window, or log to help you decipher how many instruments generated an alert at the same time.



        Adam P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by arvidvanstaey, Today, 02:19 PM
        4 responses
        10 views
        0 likes
        Last Post arvidvanstaey  
        Started by samish18, 04-17-2024, 08:57 AM
        16 responses
        56 views
        0 likes
        Last Post samish18  
        Started by jordanq2, Today, 03:10 PM
        2 responses
        8 views
        0 likes
        Last Post jordanq2  
        Started by traderqz, Today, 12:06 AM
        10 responses
        18 views
        0 likes
        Last Post traderqz  
        Started by algospoke, 04-17-2024, 06:40 PM
        5 responses
        47 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X