NexusFi: Find Your Edge


Home Menu

 





Pause in Code for two audio files to run


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one zeller4 with 2 posts (0 thanks)
    2. looks_two Big Mike with 2 posts (1 thanks)
    3. looks_3 aslan with 1 posts (0 thanks)
    4. looks_4 Richard with 1 posts (0 thanks)
    1. trending_up 3,118 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 478 since Jun 2009
Thanks Given: 1,419
Thanks Received: 404

Hello,

I've got some indicators that sound alerts when signalled. I'd like to run two audio .wav files simaltaneously. The purpose would allow me to have alerts on two separate timeframes with a similar message but could have a separate file that picks up the chart period.

 
Code
1. alert with "5RangeChart.wav"
<pause>
2. alert with "ema_cross_long_entry".wav
Hope that's understood.

Appreciate your help.
kz


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
GDP Day: The First Economic Reckoning -- Pahlavi at 6.55 …
Prediction Markets & Event Contracts
Warsh Confirmed 54-45 on PPI Day -- 97% Say He Holds in …
Prediction Markets & Event Contracts
Hormuz Normalization Collapses to 19.5% -- Iran Regime F …
Prediction Markets & Event Contracts
Pakistan Mediator in Tehran as Hormuz Normalization Coll …
Prediction Markets & Event Contracts
The Feds Stagflation Trap -- Negative Payrolls, $91 Oil, …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
23 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


Best thing is probably to make a new wav file for each conditional, so you can just use one PlaySound().

The problem is PlaySound() will execute simultaneously (as you probably figured out) so if you issue them back-to-back it's no good.

If you put in a C# delay, then literally the entire chart will halt, and especially for backtesting this is a huge no-no.

The other option would just to keep track of when you played the first sound, then play the second one later. You could use the Timer() code to do this if you are really wanting perfection, otherwise you could just check on each new tick and look at the Time stamp.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 478 since Jun 2009
Thanks Given: 1,419
Thanks Received: 404

Thanks, Mike, didn't think about the chart actually halting.

That would be NO GOOD!

thanks,
kz


Started this thread Reply With Quote
  #5 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 624 since Jan 2010
Thanks Given: 356
Thanks Received: 1,129

You could also build a sound file with a pause in it, then you still only issue a single playSound()


Reply With Quote
  #6 (permalink)
Richard
Dallas TX/USA
 
Posts: 153 since Jun 2009
Thanks Given: 33
Thanks Received: 285


Big Mike View Post
If you put in a C# delay, then literally the entire chart will halt, and especially for backtesting this is a huge no-no.

You can have the sounds play in another thread, and only launch the threads on non-historical bars, right? Then the delay won't affect anything else ninja is trying to do.


Reply With Quote
  #7 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


Richard View Post
You can have the sounds play in another thread, and only launch the threads on non-historical bars, right? Then the delay won't affect anything else ninja is trying to do.

Using system timer is the best way, if perfection is needed, buy if the indicator can be run on cobc=false then just tracking the ticks/timestamp should be good enough and a lot simpler to implement for the average ninja programmer.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote




Last Updated on May 5, 2010


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts