I am trying to run my strategy through the Strategy Analyzer but it is ignoring some orders with the following error message:
Strategy 'MOSTStrategy/-1': An order has been ignored since the stop price ‘1688’ near the bar stamped ‘05/03/2021 00:36:52’ is invalid based on the price range of the bar. This is an invalid order and subsequent orders may also be ignored.
The Instrument is GC 04-21
The OHLC of the entry bar (05/03/2021 00:35:39):
O: 1687.5
H: 1687.9
L: 1687.2
C: 1687.6
The OHLC of the ordering bar (05/03/2021 00:36:52):
O: 1687.7
H: 1688.8
L: 1687.7
C: 1688.7
Below is the debug trace for this order:
Processing bar at 05/03/2021 00:36:52
Placing Long order after close of bar = 05/03/2021 00:35:39
Stop = 1686.8
Entry = 1688
Trigger(Stop) = 1688
Breakeven = 1688.8
Target = 1689
Order Qty = 1
Ask Price = 1687.9
The order command is as follows:
if (IsInStrategyAnalyzer)
{
if (Instrument.MasterInstrument.Compare(TriggerPrice , Bars.GetAsk(CurrentBar)) > 0)
entryOrder = EnterLongStopLimit(0, true, OrderQty, EntryPrice, TriggerPrice, "EntryOrder");
else
entryOrder = EnterLongLimit(0, true, OrderQty, Bars.GetAsk(CurrentBar)+TickSize, "EntryOrder");
}
Can anyone tell me what this error means and why it is happening?
Comment