Code: Select all
private TimeSpan beginTime = new TimeSpan(6, 0, 0);
private XAverage quickMAfunction;
private XAverage slowMAFunction;
protected override void Create()
{
quickMAfunction = new XAverage(this);
slowMAFunction = new XAverage(this);
}
protected override void CalcBar()
{
quickMAfunction.Price = Bars.Close;
slowMAFunction.Price = Bars.Close;
if (Bars.TimeValue.TimeOfDay < beginTime) // Return if time is before begin time
return;
}
That's not the case, since the strategy starts after the MaxBarsBack number of bars have passed since 6:00:00.
If I include the TimeOfDay check in the entry conditions, like
Code: Select all
if (Bars.TimeValue.TimeOfDay >= beginTime &&
PublicFunctions.DoubleGreater(quickMAfunction[0], slowMAFunction[0]) &&
PublicFunctions.DoubleLess(quickMAfunction[1], slowMAFunction[1]))
{
// ..
}
My question: how can I give a strategy a begin time without this MaxBarsBack limitation? So that orders can be submitted directly after the begin time has passed, and not after MaxBarsBack number of bars have passed after the begin time?