NT7 sound alert failure - NinjaTrader | futures io social day trading
futures io futures trading


NT7 sound alert failure
Updated: Views / Replies:1,863 / 3
Created: by baberg 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
 

NT7 sound alert failure

  #1 (permalink)
Trading Apprentice
Canada
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
 
Posts: 29 since Jul 2011
Thanks: 4 given, 1 received

NT7 sound alert failure

Hello fellow trader warriors, I'm trying to program a sound alert. Here's my sample code.

 
Code
		if(FirstTickOfBar)
			{
				if(Close[1]>Close[2]) PlaySound("Alert1.wav");
				else if(Close[1]<Close[2]) PlaySound("Alert2.wav");
			}
Let me say, I cannot hear a single cow bell this way

Is there something to add anywhere on my script to make it work ? Thank you


Last edited by baberg; July 26th, 2011 at 02:06 AM.
Reply With Quote
 
  #2 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


baberg View Post
Hello fellow trader warriors, I'm trying to program a sound alert. Here's my sample code.

 
Code
        
if(FirstTickOfBar)
{
            if(Close[1]>Close[2]) PlaySound("Alert1.wav");
            else if(Close[1]<Close[2]) PlaySound("Alert2.wav");
}
Let me say, I cannot hear a single cow bell this way

Is there something to add anywhere on my script to make it work ? Thank you

The above code is correct, so I can only speculate. Please post the entire indicator next time, export via File -> Utilities -> Export NinjaScript.

The code references the bars CurrentBar - 1 and CurrentBar - 2 for the condition. When OnBarUpdate() starts its course, it will start with CurrentBar = 0, which is the first bar of the bar series. For the first bar you cannot reference prior bars, because they do not exist. NinjaTrader will therefore throw an exception and show it in the logs.

The correct way of doing it, is to only access the two prior bars starting with CurrentBar = 2, because now you have two prior bars that exist, the bars numbered 0 and 1. The modified code below should run.

 
Code
if(CurrentBar > 1 && FirstTickOfBar)
{  
          if(Close[1]>Close[2]) PlaySound("Alert1.wav");
          else if(Close[1]<Close[2]) PlaySound("Alert2.wav");
}

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #3 (permalink)
Trading Apprentice
Canada
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Forex
 
Posts: 29 since Jul 2011
Thanks: 4 given, 1 received


Hello Fat Tails, you are correct. That was it. I always have a if(CurrentBar<1) return; at the beginning of my scripts just in case. I had only forgotten to put it at 2 :tape:

Thanks mucho

Reply With Quote
 
  #4 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


baberg View Post
Hello Fat Tails, you are correct. That was it. I always have a if(CurrentBar<1) return; at the beginning of my scripts just in case. I had only forgotten to put it at 2 :tape:

Thanks mucho

The "just in case" is dangerous, it really depends on the code. For some indicators you may want to write special instructions for (CurrentBar < period).

Reply With Quote

Reply



futures io > > > > NT7 sound alert failure

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

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
NT7 audio alert - statement expected? subterfuge NinjaTrader Programming 2 March 17th, 2011 10:55 AM
Syncing a sound alert with arrows protrader007 NinjaTrader Programming 9 March 16th, 2011 09:48 PM
Alert - no sound-NT7 Al2010 NinjaTrader Programming 4 January 30th, 2011 07:02 PM


All times are GMT -4. The time now is 04:43 AM.

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-15 in 0.08 seconds with 19 queries on phoenix via your IP 54.234.255.29