Here is the non working code
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class ES : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// 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()
{
CalculateOnBarClose = true;
Add("ES 03-12", PeriodType.Minute, 10);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(SMA(BarsArray[0], 14), SMA(10), 1))
{
if (BarsInProgress == 0)
EnterLong(DefaultQuantity, "");
if (BarsInProgress == 1)
EnterLong(DefaultQuantity, "");
}
// Condition set 2
if (CrossBelow(SMA(BarsArray[0], 14), SMA(10), 1))
{
if (BarsInProgress == 0) ExitLong("", "");
if (BarsInProgress == 1) ExitLong("", "");
}
}

Comment