I ran the strategy shown below (full source code is in attached ReplayExample.zip) in Market Replay mode over your ES 03-16 Replay data for 2/17/2016.
Attached 1.jpg shows the settings I had the Simulator on while running the Replay.
Attached 2.jpg shows a chart from the replay. Here is how to read the chart:
Blue Dots= 1 Tick Bid Bars
Red dots= 1 Tick Last Bars
Green Dots= 1 Tick Ask Bars
Area circled in Blue= Shows the exact entry and exit times for the two orders displayed on the chart.
Anyway, you'll see in 2.jpg that the short exit called "TakeProfitExit" was filled at 1884.00, but no Ask bars on the chart ever dropped to 1884.00.
Any idea why this happened?
Thanks you.
{ #region Variables private double stopLoss = 2; // Default setting for StopLoss private double takeProfit = 1; // Default setting for TakeProfit #endregion protected override void Initialize() { Add("ES 03-16",PeriodType.Tick, 1, MarketDataType.Bid); Add("ES 03-16",PeriodType.Tick, 1, MarketDataType.Ask); Add("ES 03-16",PeriodType.Tick, 1, MarketDataType.Last); CalculateOnBarClose = true; } protected override void OnBarUpdate() { if (BarsInProgress == 2) { if (Position.MarketPosition == MarketPosition.Short) { ExitShortLimit(2,true,1,Position.AvgPrice - TakeProfit * TickSize, "TakeProfitExit","ShortEntry1"); ExitShortStop(2,true,1,Position.AvgPrice + StopLoss *TickSize,"StopLossExit","ShortEntry1"); } } if (BarsInProgress == 3) { if (Position.MarketPosition == MarketPosition.Flat && CrossBelow(MACD(BarsArray[3], 12, 26, 9).Avg, MACD(BarsArray [3], 12, 26, 9),1)) { EnterShort(1, 1, "ShortEntry1"); } } }
Comment