<<Code below is simplified version>>
//OnBarUpdate()
if (trend == TrendMode.Bullish)
{
SetStopLoss(signalName, CalculationMode.Price, Close[0] - StopLossMinAmount, false);
EnterLong(DefaultQuantity, signalName);
}
if (Position.MarketPosition != MarketPosition.Flat)
ChangeOrder(stopLossOrder, stopLossOrder.Quantity, stopLossOrder.LimitPrice, Close[0] + StopLossMinAmount); //This is where it doesn't work. Any number of times this code executes, the stop loss price remains the same.
//OnOrderUpdate - Get instance of stop loss order.
if (String.Equals(order.Name, "Stop Loss"))
{
if (order.OrderState == OrderState.Submitted)
{
stopLossOrder = order;
}
}
How to make this work properly? Is there any sample available?
Thanks,
Sam

Comment