Viper3
08-06-2007, 10:55 AM
Please review this strategy and show me why it is not drawing on chart, Also the audio alert,,,,,,It seems to me that maybe the codes are canceling each other out.
<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")]
public class 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>
protected override void 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>
protected override void 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");
<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")]
public class 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>
protected override void 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>
protected override void 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");