Thanks,so for the DownSwing i`d need to add the appropriate line?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Volume Spike Indicator
Collapse
X
-
Ok,i did as you suggested,and now i get an alert on each and every tickOriginally posted by NinjaTrader_Bertrand View PostCorrect. Just the opposing condition then...
here`s the snippet:
{
if (Trend[0] == 1 && Trend[1] == -1)
Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "LB.wav", 10, Color.Black, Color.Yellow);
Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "down swing", "LB.wav", 10, Color.Black, Color.Yellow);
if(CurrentBar == 0)
{
Trend.Set(Close[0] >= Open[0] ? 1 : -1);
Value.Set(Trend[0] == 1 ? Low[0] : High[0]);
return;
}
Comment
-
if (Trend[0] == 1 && Trend[1] == -1)
Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "LB.wav", 10, Color.Black, Color.Yellow);
Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "down swing", "LB.wav", 10, Color.Black, Color.Yellow);
I would not expect that part to work, the second statement will be evaluated at each OnBarUpdate() call, you also did not add the proper opposing condition for the short swing in here?
Would try something like at the bottom of the OnBarUpdate(), below the paint bar code and outside of any other condition -
if (Trend[0] == 1 && Trend[1] == -1)
Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
else if (Trend[0] == -1 && Trend[1] == 1)
Alert("myAlert2", NinjaTrader.Cbi.Priority.High, "dn swing", "Alert1.wa", 10, Color.Black, Color.Yellow);
Comment
-
No,same result.Originally posted by NinjaTrader_Bertrand View Postif (Trend[0] == 1 && Trend[1] == -1)
Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "LB.wav", 10, Color.Black, Color.Yellow);
Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "down swing", "LB.wav", 10, Color.Black, Color.Yellow);
I would not expect that part to work, the second statement will be evaluated at each OnBarUpdate() call, you also did not add the proper opposing condition for the short swing in here?
Would try something like at the bottom of the OnBarUpdate(), below the paint bar code and outside of any other condition -
if (Trend[0] == 1 && Trend[1] == -1)
Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
else if (Trend[0] == -1 && Trend[1] == 1)
Alert("myAlert2", NinjaTrader.Cbi.Priority.High, "dn swing", "Alert1.wa", 10, Color.Black, Color.Yellow);
Comment
-
Thanks, that would explain it - then I would suggest including a check to FirstTickOfBar in your Alert conditions.
if (Trend[0] == 1 && Trend[1] == -1 && FirstTickOfBar)
Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
else if (Trend[0] == -1 && Trend[1] == 1 && FirstTickOfBar)
Alert("myAlert2", NinjaTrader.Cbi.Priority.High, "dn swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
Comment
-
It seems to be working this way.Thank you for your assistance!Originally posted by NinjaTrader_Bertrand View PostThanks, that would explain it - then I would suggest including a check to FirstTickOfBar in your Alert conditions.
if (Trend[0] == 1 && Trend[1] == -1 && FirstTickOfBar)
Alert("myAlert1", NinjaTrader.Cbi.Priority.High, "up swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
else if (Trend[0] == -1 && Trend[1] == 1 && FirstTickOfBar)
Alert("myAlert2", NinjaTrader.Cbi.Priority.High, "dn swing", "Alert1.wav", 10, Color.Black, Color.Yellow);
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
168 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
324 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
250 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
350 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
179 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment