Without using IOrders:
In #region Variables private double myPrice = 0; private IOrder myEntry; In OnBarUpdate: if (/*conditions to enter here*/ true) { myPrice = Close[0] - 10 * TickSize; if (myPrice >= GetCurrentAsk()) { SetStopLoss(CalculationMode.Price, myPrice); EnterShort("entryOrder"); } } In OnExecution: if (execution.Name == "entryOrder") { myPrice = myEntry.AvgFillPrice - 10 * TickSize; if (myPrice >= GetCurrentAsk()) { SetStopLoss(CalculationMode.Price, myPrice); } } }
Leave a comment: