![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Jul 2009
Posts: 60
Thanks: 18
Thanked 2 times in 2 posts
|
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! |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
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);
}
Adam P.
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_AdamP for this post: |
|
|
|
#3 |
|
Member
Join Date: Jul 2009
Posts: 60
Thanks: 18
Thanked 2 times in 2 posts
|
Works like a charm. Thanks Adam!
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Oct 2011
Posts: 4
Thanks: 1
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
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.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#6 | |
|
Senior Member
|
Quote:
|
|
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
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?
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
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.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
SWEET! Thanks. I will try it out over the weekend!
|
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
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.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Sep 2011
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
|
No... sound alert is perfect!
|
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Oct 2011
Posts: 4
Thanks: 1
Thanked 0 times in 0 posts
|
Thanks for the help Adam.
|
|
|
|
|
|
#13 |
|
Junior Member
Join Date: Oct 2011
Posts: 4
Thanks: 1
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#14 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
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.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
The following user says thank you to NinjaTrader_AdamP for this post: |
|
|
|
#15 |
|
Junior Member
Join Date: Oct 2011
Posts: 4
Thanks: 1
Thanked 0 times in 0 posts
|
Great! Thank you.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 | Market Analyzer | 18 | 05-10-2009 01:57 AM |
| Alert on new bar? | tradingcube | Charting | 2 | 02-03-2009 12:22 PM |