Error is line 37 - "Operator * cannot be applied to NinjaTrader.Indicator.ATR and double"
Line 37 - SetTrailStop("", CalculationMode.Price, ATR(20)*TrStopATRs, false);
Strategy code below
Pl advise what i'm doing wrong?
thanks
Kiran
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// BB
/// </summary>
[Description("BB ")]
public class BBcross0TrStop : Strategy
{
#region Variables
// Wizard generated variables
private int bBperiod = 20; // Default setting for BBperiod
private double bBstdev = 1; // Default setting for BBstdev
private double trStopATRs = 3; // Default setting for TrStopATRs
// 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()
{
SetTrailStop("", CalculationMode.Price, ATR(20)*TrStopATRs, false);
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(Close, Bollinger(BBstdev, BBperiod).Lower, 1))
{
EnterLong(DefaultQuantity, "");
}
// Condition set 2
if (CrossBelow(Close, Bollinger(BBstdev, BBperiod).Lower, 1))
{
EnterShort(DefaultQuantity, "");
}
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int BBperiod
{
get { return bBperiod; }
set { bBperiod = Math.Max(10, value); }
}
[Description("")]
[GridCategory("Parameters")]
public double BBstdev
{
get { return bBstdev; }
set { bBstdev = Math.Max(0.4, value); }
}
[Description("")]
[GridCategory("Parameters")]
public double TrStopATRs
{
get { return trStopATRs; }
set { trStopATRs = Math.Max(1.5, value); }
}
#endregion
}
Comment