Time frame in sample: 12 minutes.
Sample strategy:
protected override void Initialize()
{
SMA(Fast).Plots[0].Pen.Color = Color.Orange;
SMA(Slow).Plots[0].Pen.Color = Color.Green;
Add(SMA(Fast));
Add(SMA(Slow));
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick).
/// </summary>
protected override void OnBarUpdate()
{
if (CrossAbove(SMA(Fast), SMA(Slow), 1))
{
this.Print( string.Format( "EnterLong ON {0}", Time[0] ) );
EnterLong();
}
else if (CrossBelow(SMA(Fast), SMA(Slow), 1))
{
this.Print( string.Format( "EnterShort ON {0}", Time[0] ) );
EnterShort();
}
}
----
Debug results:
EnterShort ON 23.09.2010 10:00:00
EnterLong ON 23.09.2010 15:24:00
EnterShort ON 23.09.2010 17:24:00
EnterLong ON 23.09.2010 18:12:00
Trades list in simulator is attached.
Time in strategy is Time[0] = 10:00 and execute EnterShort.
But Simulator wait one bar - 12 minutes for execution, start position at 10:12:00.
MarketReplay work correctly, execute trade on 10:00:08
Does someone know, why simulator delay order execution after one bar?
Thank you.
Comment