If I have the code shown below, it does nothing. But it should print "testing" why does it not work?
However, if I uncomment out the add(Period)s and the additional PrintWithTimeStamp()s it prints out the following:
testing
8/31/2011 8:05:11 PM 0BarsInProgress 2
8/31/2011 8:05:11 PM 2BarsInProgress 2
However, I would think that it should print out
testing
8/31/2011 8:05:11 PM 0BarsInProgress 0
8/31/2011 8:05:11 PM 0BarsInProgress 0
8/31/2011 8:05:11 PM 1BarsInProgress 1
8/31/2011 8:05:11 PM 0BarsInProgress 0
8/31/2011 8:05:11 PM 2BarsInProgress 2
What it going on here?
Thanks,
Matt
See code below
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class test : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
#endregion
//DateTime startTime;
/// <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 = false;
// Add(PeriodType.Minute, 60);
// Add(PeriodType.Second, 1);
Print("end initialize");
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
Print("testing");
// PrintWithTimeStamp("0BarsInProgress " + BarsInProgress);
// if (BarsInProgress==1){
// PrintWithTimeStamp("1BarsInProgress " + BarsInProgress);
// }
// if (BarsInProgress==2){
// PrintWithTimeStamp("2BarsInProgress " + BarsInProgress);
// }
}
#region Properties
[Description("")]
[GridCategory("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}

Comment