See the code below please
************ Stop Loss Created 2 Ticks Below Closed Price *******************
protected override void OnExecution(IExecution execution)
{
if // we need a Stop loss to protect the long Position
(longOrder != null && longOrder == execution.Order && execution.Order.OrderState == OrderState.Filled)
{
// (2)
stopOrder = SubmitOrder(0, OrderAction.SellShort, OrderType.StopLimit, 1, tickPrice +2 * TickSize, tickPrice +2 * TickSize, "Oil", "Short limit entry");
******************* This should move the Stop Loss *************************
protected override void OnBarUpdate()
{
if(Position.MarketPosition == MarketPosition.Long)
{
ChangeOrder(stopOrder, 1, stopOrder.LimitPrice, tickPrice +1 * TickSize);

Comment