Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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.
Hope that's understood.
Appreciate your help.
kz
Can you help answer these questions from other members on NexusFi?
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.
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.