I am running a strategy on playback connection for testing purposes on the ES S&P 500 Mini 15 minute bar chart.
Below shows my logic for submitting an order.
---------------------------------------------------------------------
if (State == State.SetDefaults)
{
Calculate.OnEachTick;
ShortStopTicks = 4;
}
else if (State == State.Configure)
{
AddDataSeries(Data.BarsPeriodType.Minute, 15);
SetStopLoss("SSEntry", CalculationMode.Ticks, ShortStopTicks, false);
}
protected override void OnBarUpdate()
{
Benchmark = Open[0];
if ((GetCurrentAsk(1) == Benchmark)
|| (GetCurrentBid(1) == Benchmark))
{
EnterLongStopMarket(0,true,Convert.ToInt32(OrderQu antity), Benchmark + 1, "LSEntry");
}
---------------------------------------------------------------------
When a new 15 minute bar appears, the strategy captures the open price of that bar and stores it as "Benchmark". So if current bid or ask == Benchmark, then place long stop order one point above Benchmark.
When the order is placed and the market reaches my entry, a stop loss is placed 4 ticks below, which essentially is the same price of "Benchmark". If the market comes back down to touch my stop, the strategy should place the same order again after I am stopped because it has also touched benchmark again. It does not happen all the time, but sometimes the order is not placed again when the market comes to touch my stop while still touching "Benchmark" within that same second.
At first I thought the market was probably just jumping over my "Benchmark" value which caused the orders to not be placed but I zoomed into the one tick chart and saw that the market touched my Benchmark multiple times.
My hunch is that the data I am receiving updates by the second, and if the market touches my stoploss/ "benchmark" value, say at 8:30:01, the strategy will perform the stoploss exit first only within that second will not perform the submit order method unless the market is still touching my "Benchmark" at 8:30:02.
This happening has cause me to miss out on important trades.
Do you have any insight as to why this is happening?

Comment