Andres
Announcement
Collapse
No announcement yet.
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();
-
Hi, thank you for your help, sorry im not good at this, could you kindly make it a .cs file,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
-
I am trying, this error appearsOriginally 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 Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
637 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
366 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
107 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
569 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
571 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment