Syncing a sound alert with arrows - NinjaTrader Programming | futures io social day trading
futures io futures trading


Syncing a sound alert with arrows
Updated: Views / Replies:1,511 / 9
Created: by protrader007 Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Syncing a sound alert with arrows

  #1 (permalink)
Elite Member
Bee Cave,Tx
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: CL
 
Posts: 53 since Aug 2010
Thanks: 31 given, 20 received

Syncing a sound alert with arrows

I'm trying to play a sound at the same time that I get an arrow. I'm using the code below and get both an arrow and a sound when the conditions are true but I also get a sound when there is no arrow.
Can someone please tell me what I'm doing wrong?
Thanks.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
 Vendor: www.integrity-traders.com 
East Rochester, NY
 
Futures Experience: Intermediate
Platform: NT
 
eDanny's Avatar
 
Posts: 327 since Jul 2009
Thanks: 17 given, 419 received



protrader007 View Post
I'm trying to play a sound at the same time that I get an arrow. I'm using the code below and get both an arrow and a sound when the conditions are true but I also get a sound when there is no arrow.
Can someone please tell me what I'm doing wrong?
Thanks.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

You have two tests going on here. They might be both true at the same time or separately. Without seeing more of your code it is hard to tell how to rewrite it.

Dan

Reply With Quote
 
  #4 (permalink)
Elite Member
Bee Cave,Tx
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: CL
 
Posts: 53 since Aug 2010
Thanks: 31 given, 20 received


eDanny View Post
You have two tests going on here. They might be both true at the same time or separately. Without seeing more of your code it is hard to tell how to rewrite it.

Dan

I'm testing for a bunch of conditions and if they are all true I draw an arrow. This part is working OK, no problems at all.
I now want to play an alert sound if the same conditions are true in addition to drawing the arrow. Do I need to repeat the code and test for all the same conditions again or is there some way to say "draw an arrow" AND "play a sound" for the same set of conditions?

Reply With Quote
 
  #5 (permalink)
 Vendor: www.integrity-traders.com 
East Rochester, NY
 
Futures Experience: Intermediate
Platform: NT
 
eDanny's Avatar
 
Posts: 327 since Jul 2009
Thanks: 17 given, 419 received


protrader007 View Post
I'm testing for a bunch of conditions and if they are all true I draw an arrow. This part is working OK, no problems at all.
I now want to play an alert sound if the same conditions are true in addition to drawing the arrow. Do I need to repeat the code and test for all the same conditions again or is there some way to say "draw an arrow" AND "play a sound" for the same set of conditions?

Using PlaySound can be tricky because it will repeatedly play the sound while the condition exists. Therefore it is not very suitable out of the box for realtime, CalculateOnBarClose=false type indicators unless you code it right. You might want to set a bool variable to true when your condition triggers and on FirstTickofBar (the next bar) test for the bool and play the sound. Change variable to false. Playing in real time can work pretty much then same but every time your condition exists you would get the sound, even multiple times per bar unless you restrict it with code. You will have to figure out what you really want and code around it.

Dan

Reply With Quote
The following user says Thank You to eDanny for this post:
 
  #6 (permalink)
Elite Member
Lubbock TX
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Stage 5 Trading
Favorite Futures: CL
 
MWinfrey's Avatar
 
Posts: 1,879 since Jul 2009
Thanks: 1,449 given, 3,306 received


protrader007 View Post
I'm testing for a bunch of conditions and if they are all true I draw an arrow. This part is working OK, no problems at all.
I now want to play an alert sound if the same conditions are true in addition to drawing the arrow. Do I need to repeat the code and test for all the same conditions again or is there some way to say "draw an arrow" AND "play a sound" for the same set of conditions?

Just put the logic Danny suggested in the same block of code where you draw the arrow.

Reply With Quote
The following user says Thank You to MWinfrey for this post:
 
  #7 (permalink)
Elite Member
East Coast
 
Futures Experience: Beginner
Platform: Ninja
Favorite Futures: ES, NQ
 
Posts: 125 since Apr 2010
Thanks: 55 given, 81 received


protrader007 View Post
I'm trying to play a sound at the same time that I get an arrow. I'm using the code below and get both an arrow and a sound when the conditions are true but I also get a sound when there is no arrow.
Can someone please tell me what I'm doing wrong?
Thanks.

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

I think if you are calculation on bar close = true, you could do


if (ShowArrows)
{
Draw...
if (soundOn &&...
}

if calc on bar close = false, then you would have to have the sound conditional on a flag and outside the brackets, since the arrow condition might be met but it might not be the 1st tick of bar anymore to trigger the sound.

Reply With Quote
The following user says Thank You to Tarkus11 for this post:
 
  #8 (permalink)
Elite Member
Bee Cave,Tx
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: CL
 
Posts: 53 since Aug 2010
Thanks: 31 given, 20 received


Tarkus11 View Post
I think if you are calculation on bar close = true, you could do


if (ShowArrows)
{
Draw...
if (soundOn &&...
}

if calc on bar close = false, then you would have to have the sound conditional on a flag and outside the brackets, since the arrow condition might be met but it might not be the 1st tick of bar anymore to trigger the sound.


MWinfrey View Post
Just put the logic Danny suggested in the same block of code where you draw the arrow.


eDanny View Post
Using PlaySound can be tricky because it will repeatedly play the sound while the condition exists. Therefore it is not very suitable out of the box for realtime, CalculateOnBarClose=false type indicators unless you code it right. You might want to set a bool variable to true when your condition triggers and on FirstTickofBar (the next bar) test for the bool and play the sound. Change variable to false. Playing in real time can work pretty much then same but every time your condition exists you would get the sound, even multiple times per bar unless you restrict it with code. You will have to figure out what you really want and code around it.

Dan

Thanks guys, I really appreciate your help. Now I understand the problem.
I am using CalculateOnBarClose=false and will figure out how to code around it.

Reply With Quote
 
  #9 (permalink)
Elite Member
Bee Cave,Tx
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: CL
 
Posts: 53 since Aug 2010
Thanks: 31 given, 20 received


eDanny View Post
Using PlaySound can be tricky because it will repeatedly play the sound while the condition exists. Therefore it is not very suitable out of the box for realtime, CalculateOnBarClose=false type indicators unless you code it right. You might want to set a bool variable to true when your condition triggers and on FirstTickofBar (the next bar) test for the bool and play the sound. Change variable to false. Playing in real time can work pretty much then same but every time your condition exists you would get the sound, even multiple times per bar unless you restrict it with code. You will have to figure out what you really want and code around it.

Dan

FYI, I played around with setting a bool variable, testing it and resetting it but in the end I decided to use the Alert function. Much easier to code and I also have the results in the Alert window as a bonus!

Reply With Quote
 
  #10 (permalink)
Elite Member
East Coast
 
Futures Experience: Beginner
Platform: Ninja
Favorite Futures: ES, NQ
 
Posts: 125 since Apr 2010
Thanks: 55 given, 81 received



protrader007 View Post
FYI, I played around with setting a bool variable, testing it and resetting it but in the end I decided to use the Alert function. Much easier to code and I also have the results in the Alert window as a bonus!


Just an FYI - I ran into this in the past too. For my purposes, the way I dealt with my own alert approach was
1) private int alertcounter = 0;
2)
if (whateverConditions && alertcounter == 0)
{
Alert Stuff
alertcounter++;
}

3) Somewhere outside the brackets has to be some logical condition that resets alertcounter to 0 again for the next time. Like if the condition was an upcross of a shorter moving avg over a longer mov avg, when they cross in the other direction, alertcounter would be reset to 0 (though maybe there should be an upcrossalertcounter and downcrossalertcounter in that case...).

I could do stuff with the integer counter (like use modulus (%)) to alert on odd or even counter or whatever (if I chose not to reset it).

Reply With Quote

Reply



futures io > > > > > Syncing a sound alert with arrows

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sound alert if contract number exceeds a certain level in the Dom? DrE6 NinjaTrader 46 November 15th, 2016 06:23 PM
How to code a sound alert Saroj NinjaTrader Programming 12 September 27th, 2015 06:40 PM
DoubleMAPaint with sound arrows... sam028 NinjaTrader Programming 68 December 13th, 2013 10:56 PM
NT7 sound alert failure baberg NinjaTrader 3 July 27th, 2011 06:38 AM
Alert - no sound-NT7 Al2010 NinjaTrader Programming 4 January 30th, 2011 07:02 PM


All times are GMT -4. The time now is 01:25 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-11 in 0.13 seconds with 19 queries on phoenix via your IP 54.145.16.43