NexusFi: Find Your Edge


Home Menu

 





Pause in Code for two audio files to run


Discussion in NinjaTrader

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




 
Search this Thread

Pause in Code for two audio files to run

  #1 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
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?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Increase in trading performance by 75%
The Elite Circle
How to apply profiles
Traders Hideout
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
18 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 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,440 since Jun 2009
Thanks Given: 33,213
Thanks Received: 101,599


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 Twitter 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: 477 since Jun 2009
Thanks Given: 1,416
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: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127

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: 284


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,440 since Jun 2009
Thanks Given: 33,213
Thanks Received: 101,599


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 Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on May 5, 2010


© 2024 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 - Privacy Policy - Downloads - Top
no new posts