I am not able to get the following strategy up and running even though it backtests perfectly well in the Strategy Analyzer. I suppose the way I am handling the BarsInProgress functionality leads to this behavior. Basically, when I launch the strategy in the Control Center it doesn't issue the trades it should. It looks like it is not able to calculate the dummy1 variable from the index data set, even though does it perfectly well when backtesting.
Here's a simplified code sample. Would you pls let me know what am I doing wrong that prevents the strategy to function in real time as it functions in backtesting?
Thanks
*************************
protected override void Initialize()
{
Add ("^DAX",PeriodType.Day,1);
Add (PeriodType.Minute,5);
Add (PeriodType.Minute,60);
}
protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
{
ss = StdDev(100)[0];
ff = StdDev(10)[0];
dummy1 = 1+ff/ss;
}
H4= ((dummy1*(PriorDayOHLC().PriorClose[0]);
if (BarsInProgress == 3 && CrossAbove(Close, H4, 1) )
{
EnterLong();
}
}
*************************
Comment