Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market-Specific PlaySound

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

    Market-Specific PlaySound

    Hi

    I've developed a strategy that runs on a variety of markets and plays a sound file whenever it produces a signal. Now I'd like it to play a market-specific sound file, ie when there's a signal in the Dax it should say "Dax" when there's a signal in the EuroFX it should say "Euro" etc.

    I've got all the sound files recorded and the naming of the different markets is in place as well, following this example:

    if (Instrument.MasterInstrument.Name == "FDAX")

    How do I link the PlaySound command with the specific market the strategy is applied to?

    Thanks a lot.
    Last edited by laocoon; 01-21-2011, 10:04 AM.

    #2
    Hi laocoon,

    You've got the conditional statement down, so you just add the PlaySound command afterword, for each instrument.

    if (Instrument.MasterInstrument.Name == "FDAX")
    PlaySound(@"C:\myFDAXSound.wav");

    For structuring your code, it's best to nest these within the order placement block, so that you don't have to duplicate the order placement conditionals for each instrument.

    if (orderConditions)
    {
    //place orders

    if (Instrument.MasterInstrument.Name == "FDAX")
    PlaySound(@"C:\myFDAXSound.wav");

    if (Instrument.MasterInstrument.Name == "ES")
    PlaySound(@"C:\myESSound.wav");

    }
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi RyanM

      Excellent! For some reason I didn't think about that myself.

      Thanks a lot.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      67 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      60 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X