.........
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = @"Enter the description for your new custom Strategy here.";
Name = "DoubleLimitOrders";
Calculate = Calculate.OnEachTick;
................
protected override void OnBarUpdate()
{
if(State == State.Historical)
{
return;
}
//Add your custom strategy logic here.
if(Position.MarketPosition == MarketPosition.Flat && entryOrder == null)
{
EnterLongStopMarket(0, true, 1, Close[0] + 8 * TickSize, "long limit entry");
}
Ok simple enough i have a stop market order 8 ticks above current price. As current price is changing so is my stop market order accordingly .
But then i add ,this to the code above:
protected override void OnOrderUpdate(Order order, double limitPrice,
double stopPrice, int quantity,
int filled, double averageFillPrice,
OrderState orderState, DateTime time,
ErrorCode error, string nativeError)
{
if(order.Name == "long limit entry")
entryOrder = order;
}
My stop market order has a fix price now. Why? I just assigned a stop market order named "long limit entry" to the variable entryOrder. What is going on?

Comment