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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X