protected override void Initialize()
{
CalculateOnBarClose = false;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
Print("EMA50-"+EMA(50)[0]+" EMA100-"+EMA(100)[0]+" STOC-"+Stochastics(5, 3, 3).K);
if (EMA(50)[0] > EMA(100)[0]
&& CrossAbove(GetCurrentAsk(), EMA(50), 5)
&& CrossAbove(Stochastics(5, 3, 3).K, 20, 5))
{
Alert("MyAlert0", Priority.High, "Buy Long Signal", @"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert1.wav", 5, Color.White, Color.Black);
}
if (EMA(50)[0] < EMA(100)[0]
&& CrossBelow(GetCurrentBid(), EMA(50), 5)
&& CrossBelow(Stochastics(5, 3, 3).K, 80, 5))
{
Alert("MyAlert0", Priority.High, "Buy Short Signal", @"C:\Program Files (x86)\NinjaTrader 7\sounds\Alert1.wav", 5, Color.White, Color.Black);
}
}
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Alerts using a Strategy in a Chart
Collapse
X
-
Alerts using a Strategy in a Chart
I have a very simple strategy that tests 2 emas and a Stochastic, and having sat and watched the output scroll past for the last couple of hours, I can see several occasions that I think it should have alerted me, but it hasn't. My guess is that been new to Ninja Script I've made a simple error, but I'm damned if I can find it. I've enclosed the code below, can anybody tell me what I've done wrong.
Code:Tags: None
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
558 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment