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
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
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
-
Hello,
Thank you for the question.
I will try and run this, could you provide details on the instrument and chart settings that this works on?
Also can you provide a sample of the output where you see it should have been triggered?
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by XXtrader, Yesterday, 11:30 PM
|
2 responses
11 views
0 likes
|
Last Post
by XXtrader
Today, 03:07 AM
|
||
Started by Waxavi, Today, 02:10 AM
|
0 responses
6 views
0 likes
|
Last Post
by Waxavi
Today, 02:10 AM
|
||
Started by TradeForge, Today, 02:09 AM
|
0 responses
11 views
0 likes
|
Last Post
by TradeForge
Today, 02:09 AM
|
||
Started by Waxavi, Today, 02:00 AM
|
0 responses
2 views
0 likes
|
Last Post
by Waxavi
Today, 02:00 AM
|
||
Started by elirion, Today, 01:36 AM
|
0 responses
7 views
0 likes
|
Last Post
by elirion
Today, 01:36 AM
|
Comment