Go Back   NinjaTrader Support Forum > NinjaTrader 7 > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 10-21-2011, 10:09 AM   #1
Style
Member
 
Join Date: Jul 2009
Posts: 60
Thanks: 18
Thanked 2 times in 2 posts
Default Alert on new bar?

I trade with longer term tick bars, where it takes usually 15 to 30 minutes to complete a bar. I often find myself checking the chart, waiting on the bar to close before I take action. It would be nice if I didn't have to watch, if I could just check back after the bar completes.

Is there an indicator that will sound an audible alert on the close of the bar? If not, what would be the best way to create one?

Thanks!
Style is offline  
Reply With Quote
Old 10-21-2011, 11:11 AM   #2
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 387 times in 375 posts
Default

Style,

Yes, this is possible.

Just create a new Indicator using Tools > Edit NinjaScript > Indicator, make sure CalculateOnBarClose = true, then add the following code to OnBarUpdate()


Code:
        protected override void Initialize()
        {
            Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
            Overlay				= true;
        }

        protected override void OnBarUpdate()
        {
			Alert("Bar CLOSED!", NinjaTrader.Cbi.Priority.High, "Bar CLOSED!", "Alert1.wav", 10, Color.Red, Color.Yellow);
        }
NinjaTrader_AdamP is offline  
Reply With Quote
The following user says thank you to NinjaTrader_AdamP for this post:
Old 10-24-2011, 06:54 AM   #3
Style
Member
 
Join Date: Jul 2009
Posts: 60
Thanks: 18
Thanked 2 times in 2 posts
Default

Works like a charm. Thanks Adam!
Style is offline  
Reply With Quote
Old 10-28-2011, 09:05 AM   #4
Jim P
Junior Member
 
Join Date: Oct 2011
Posts: 4
Thanks: 1
Thanked 0 times in 0 posts
Default

Hello,
I'm new to Ninjatrader so please excuse my newbie slowness in figuring this out. I'm also looking for an alert at the close of a tick bar. When following these instructions "Tools > Edit NinjaScript > Indicator" I have come to the point where I have to choose the indicator to modify. Corrrect? If so which one should I choose? Or do I build one from scratch?
Jim P is offline  
Reply With Quote
Old 10-28-2011, 09:25 AM   #5
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 387 times in 375 posts
Default

Jim P,

I am happy to assist you.

The code I posted in post number 2 will work for you. For future reference, you can go to Tools > New NinjaScript > Indicator then just paste this code into your OnBarUpdate() method. However, Ill just attach this indicator below. To import it, go to Files > Utilities > Import NinjaScript.

Please let me know if I may assist further.
Attached Files
File Type: zip CloseBarAlert.zip (1.8 KB, 334 views)
NinjaTrader_AdamP is offline  
Reply With Quote
Old 10-28-2011, 09:36 AM   #6
koganam
Vendor
 
Join Date: Feb 2008
Location: http://omegasigmaindicators.com
Posts: 6,910
Thanks: 44
Thanked 2,807 times in 2,292 posts
Default

Quote:
Originally Posted by JIm P View Post
Hello,
I'm new to Ninjatrader so please excuse my newbie slowness in figuring this out. I'm also looking for an alert at the close of a tick bar. When following these instructions "Tools > Edit NinjaScript > Indicator" I have come to the point where I have to choose the indicator to modify. Corrrect? If so which one should I choose? Or do I build one from scratch?
Create a new indicator.
koganam is offline  
Reply With Quote
Old 10-28-2011, 10:22 AM   #7
bbelliveau
Junior Member
 
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default MACD CrossOver Alert

Hi there. I'm not sure if I'm in the right forum, but i'd like to know if there's a custom indicator to get an Alert when there's a MACD crossover? I tried searching, but came up empty. Thoughts?
bbelliveau is offline  
Reply With Quote
Old 10-28-2011, 10:45 AM   #8
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 387 times in 375 posts
Default MACD w/ Alerts

bbelliveau,

I am happy to assist you.

Generally, we do not do custom programming here at NinjaTrader however you are in luck. I have previously created an indicator like this. Please find it attached.

Please let me know if I may assist further.
Attached Files
File Type: zip MACDwAlerts.zip (2.4 KB, 56 views)
NinjaTrader_AdamP is offline  
Reply With Quote
Old 10-28-2011, 10:47 AM   #9
bbelliveau
Junior Member
 
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

SWEET! Thanks. I will try it out over the weekend!
bbelliveau is offline  
Reply With Quote
Old 10-28-2011, 10:54 AM   #10
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 387 times in 375 posts
Default

bbelliveau,

You will only get alerts in Market Replay or on live data with this indicator through the Alerts window. This is located in File > New > Alerts. It will play an alert sound and display some text in this window.

If what you meant was a signal such as a color change or a drawn object, such as an arrow, this is different.

Please let me know if I can assist further.
NinjaTrader_AdamP is offline  
Reply With Quote
Old 10-28-2011, 10:57 AM   #11
bbelliveau
Junior Member
 
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

No... sound alert is perfect!
bbelliveau is offline  
Reply With Quote
Old 10-28-2011, 12:00 PM   #12
Jim P
Junior Member
 
Join Date: Oct 2011
Posts: 4
Thanks: 1
Thanked 0 times in 0 posts
Default

Thanks for the help Adam.
Jim P is offline  
Reply With Quote
Old 10-28-2011, 12:22 PM   #13
Jim P
Junior Member
 
Join Date: Oct 2011
Posts: 4
Thanks: 1
Thanked 0 times in 0 posts
Default

Hello Adam,
Just wondering how/if I can change the alert to a different sound. Can I import different sounds for this indicator or would I have to create the indicator from scratch?
Jim P is offline  
Reply With Quote
Old 10-28-2011, 12:47 PM   #14
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 387 times in 375 posts
Default

Jim P,

Sounds are located in C:\Program Files (x86)\NinjaTrader 7\sounds

You can change the code by going to Tools > Edit NinjaScript > Select the indicator, then change the line :

Alert("Bar CLOSED!", NinjaTrader.Cbi.Priority.High, "Bar CLOSED!", "Alert1.wav", 10, Color.Red, Color.Yellow);

Where it says "Alert1.wav" to whatever you want in the Sounds directory. Afterwards, hit the compile button in the top toolbar. Using custom sounds is not supported but you can try adding a sound in there in .wav format.

Please let me know if I can assist further.
NinjaTrader_AdamP is offline  
Reply With Quote
The following user says thank you to NinjaTrader_AdamP for this post:
Old 10-28-2011, 01:28 PM   #15
Jim P
Junior Member
 
Join Date: Oct 2011
Posts: 4
Thanks: 1
Thanked 0 times in 0 posts
Default

Great! Thank you.
Jim P is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
One Alert per bar Viper3 Strategy Development 7 06-30-2011 11:39 AM
sound alert() for a big bar crmcwi Indicator Development 2 05-11-2010 05:30 AM
Alert set to once per bar blarouche Indicator Development 4 08-18-2009 09:12 AM
audio alert upon completion of a bar stephenszpak Platform Technical Support 18 05-10-2009 01:57 AM
Alert on new bar? tradingcube Platform Technical Support 2 02-03-2009 01:22 PM


All times are GMT -6. The time now is 04:11 AM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content. Visit the CFTC resources for education regarding the industry and signs of fraud.