Andres
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
How to set alarm after a candle closes
Collapse
X
-
You use a Timer from the System.Timers namespace.
NB there are other timers in System.Threading.Timer, System.Windows.Forms.Timer, System.Web.UI.Timers and System.Windows.Threading.DispatcherTimer make sure you import System.Timers.Timer and not one of the other namespaces
Be sure to set AutoReset to false or it will repeat every 240 seconds
Code:Timer timer = new Timer(TimeSpan.FromSeconds(240).TotalMilliseconds); timer.AutoReset = false; timer.Elapsed += (o, args) => { PlaySound(NinjaTrader.Core.Globals.InstallDir + @"\sounds\Alert1.wav" timer.Dispose(); }; timer.Start();
-
Originally posted by reach4thelasers View PostYou use a Timer from the System.Timers namespace.
NB there are other timers in System.Threading.Timer, System.Windows.Forms.Timer, System.Web.UI.Timers and System.Windows.Threading.DispatcherTimer make sure you import System.Timers.Timer and not one of the other namespaces
Be sure to set AutoReset to false or it will repeat every 240 seconds
Code:Timer timer = new Timer(TimeSpan.FromSeconds(240).TotalMilliseconds); timer.AutoReset = false; timer.Elapsed += (o, args) => { PlaySound(NinjaTrader.Core.Globals.InstallDir + @"\sounds\Alert1.wav" timer.Dispose(); }; timer.Start();
would be much appreciated
Andres
Comment
-
I'm sure if you really apply yourself you will figure it out. Open the ninjascript editor, make a new indicator, and paste that into OnBarUpdate
Comment
-
Originally posted by reach4thelasers View PostI'm sure if you really apply yourself you will figure it out. Open the ninjascript editor, make a new indicator, and paste that into OnBarUpdate
BTW i do need it to repeat in that interval (after a 5 min candle closes, 240 seconds, activate the sound alert) so i did set rearm true
thank youLast edited by andddres1; 06-14-2017, 10:35 AM.
Comment
-
whoops my-bad on the missing semi-colon. I copied and pasted it straight of the Ninjatrader docs onto the forum.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by proptradingshop, 03-21-2024, 09:50 AM
|
5 responses
25 views
0 likes
|
Last Post Today, 05:17 AM | ||
Started by MaupinFinche, Today, 05:08 AM
|
0 responses
2 views
0 likes
|
Last Post
by MaupinFinche
Today, 05:08 AM
|
||
Started by Enkidu, Yesterday, 06:40 AM
|
9 responses
35 views
0 likes
|
Last Post
by Enkidu
Yesterday, 01:11 PM
|
||
Started by Mestor, 03-10-2023, 01:50 AM
|
12 responses
307 views
0 likes
|
Last Post
by z.franck
Today, 04:29 AM
|
||
Started by AgriTrdr, 07-16-2023, 12:54 PM
|
32 responses
268 views
0 likes
|
Last Post
by f.saeidi
Yesterday, 06:49 AM
|
Comment