Also, I'm trying to set up a basic long only 200 day moving average crossover system using Yahoo data as a test. The Sample systems all seem to run fine. What is wrong with my system below (told you I was a newbie):
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class MA200 : Strategy
{
#region Variables
// Wizard generated variables
private int mAPeriod = 200; // Default setting for MAPeriod
// 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;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (Close[0] >= MAPeriod)
{
EnterLong(DefaultQuantity, "");
}
// Condition set 2
if (Close[0] < MAPeriod)
{
ExitLong("", "");
}
}
#region Properties
[Description("the moving average period")]
[Category("Parameters")]
public int MAPeriod
{
get { return mAPeriod; }
set { mAPeriod = Math.Max(1, value); }
}
#endregion
}
}
#region Wizard settings, neither change nor remove
Comment