I'm getting the error "Order rejected". And in another window it says: "Sell stop or sell stop limit orders can't be placed above the market".
But the price is above the entry for my EnterShortStopMarket.
These are the error windows and the Output. I've placed a Print to show the values, and the market price is above my entry.
I get this error while in playback mode 1x. Calcuate onEactTick
The EnterShortStopMarket runs on FirstTickOfBar
Here is the chart screenshot. Clearly the bar opens above the stopPrice
This is the part of the code where I place the limit order:
This is inside another IF statement --> IsFirstTickOfBar
if (Position.MarketPosition == MarketPosition.Flat) { if (BearSignal[1] == 1) { if (Open[0] > _shortEntry && Close[0] > _shortEntry) { myEntryOrder = EnterShortStopMarket(0, false, 1, _shortEntry, "Short_Entry"); Print(string.Format("EnterShortStopMarket {0}; {1}; {2}; {3}; {4}; {5}, Current: {6}", Time[0], CurrentBar, BullSignal[1], BearSignal[1], Open[0], _shortEntry, Close[0])); } else { myEntryOrder = EnterShortLimit(0, false, 1, _shortEntry, "Short_Entry"); Print(string.Format("EnterShortLimit {0}; {1}; {2}; {3}; {4}; {5}, Current: {6}", Time[0], CurrentBar, BullSignal[1], BearSignal[1], Open[0], _shortEntry, Close[0])); } } if (BullSignal[1] == 1) { if (Open[0] < _longEntry && Close[0] < _longEntry) { myEntryOrder = EnterLongStopMarket(0, false, 1, _longEntry, "Long_Entry"); Print(string.Format("EnterLongStopMarket {0}; {1}; {2}; {3}; {4}; {5}", Time[0], CurrentBar, BullSignal[1], BearSignal[1], Open[0], _longEntry)); } else { myEntryOrder = EnterLongLimit(0, false, 1, _longEntry, "Long_Entry"); Print(string.Format("EnterLongLimit {0}; {1}; {2}; {3}; {4}; {5}", Time[0], CurrentBar, BullSignal[1], BearSignal[1], Open[0], _longEntry)); } } }
Comment