<summary>
/// Plots when the HMA crosses KAMA and ADX value > 30
///</summary>
[Description("Plots when the HMA crosses KAMA and ADX value > 30")]
[Gui.Design.DisplayName("HMAxKAMAvADX")]
publicclass HMAxKAMAvADX : Strategy
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion
///<summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
///</summary>
protectedoverridevoid Initialize()
{
Add(HMA(21));
Add(KAMA(2, 10, 30));
Add(ADX(14));
Add(HMA(21));
Add(KAMA(2, 10, 30));
Add(ADX(14));
CalculateOnBarClose = true;
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{
// Condition set 1
if (CrossAbove(HMA(21), KAMA(2, 10, 30), 1)
&& ADX(14)[0] > 30)
{
DrawArrowUp("My up arrow" + CurrentBar, 0, ADX(14)[0], Color.Blue);
PlaySound(@"C:\Program Files\NinjaTrader 6\sounds\Alert1.wav");
}
// Condition set 2
if (CrossBelow(HMA(21), KAMA(2, 10, 30), 1)
&& ADX(14)[0] > 30)
{
DrawArrowDown("My down arrow" + CurrentBar, 0, ADX(14)[0], Color.Magenta);
PlaySound(@"C:\Program Files\NinjaTrader 6\sounds\Alert2.wav");

Comment