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 sjsj2732, Yesterday, 04:31 AM
|
0 responses
30 views
0 likes
|
Last Post
by sjsj2732
Yesterday, 04:31 AM
|
||
|
Started by NullPointStrategies, 03-13-2026, 05:17 AM
|
0 responses
286 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
282 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
132 views
1 like
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
90 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|

Comment