View Full Version : Donchian Alert NT7
HJBaggaley
02-21-2011, 10:23 AM
I am trying to work out how to set an alert via the MA for when the price crosses Donchian mean line. Can anyone point me in the right direction please.
It gets really messy to set up a strategy across several currency pairs and time frames, plus NT does not seem to cope well with the extra workload, so thought it should be fairly easy to set it up on MA.
NinjaTrader_RyanM
02-21-2011, 10:37 AM
Hello HJBaggaley,
Yes, the market analyzer is good for checking conditions across a group of instruments. A common approach for alerting or filtering is setting plot as 1 when conditions are true and 0 otherwise. You can then check any alerting when that column == 1.
if (CrossAbove(Close, DonchianChannel(14).Mean, 1))
{
Plot0.Set(1);
}
else
Plot0.Set(0);
HJBaggaley
02-21-2011, 10:42 AM
Thanks for your prompt reply. Sorry to sound a bit thick,. The only 'plot' in MA gives a choice of Mean, Lower or Upper.
I have to then assume you are suggesting 'writing' a code for the MA?
NinjaTrader_RyanM
02-21-2011, 10:46 AM
Yes, setting crossover alerts with another indicator and price requires custom programming. The snippet included in my first reply will do this. Click Tools > New > NinjaScript > Indicator
Walk through the wizard and then paste that snippet in the Indicators OnBarUpdate() section.
HJBaggaley
02-21-2011, 11:40 AM
Thanks for that
It was not really the answer I was looking for as I am not a programmer and although I have tried to follow your notes, and in the past the copious help guides to no avail, I am obviously doing something wrong as I keep getting error messages.
I was thinking that there should be a way of setting this up within MA itself rather than taking a masters in simple programming.
Thanks anyway.