I am trying to code a strategy that woks on Calculate.OnEachTick that submits Short/LongStopMarket orders a few ticks below/above the Stop price and I need to cancel the pending orders before they are executed, in case my condition for triggering the order gets invalidated before triggering the order.
I found that I have to 'Assign entryOrder in OnOrderUpdate() to ensure the assignment occurs when expected.', but I must have left something out, coz I'm getting the error 'No suitable method found to override'.
I suspect it is because there is nothing in the () after OnOrderUpdate, but I don't quite understand how to fill in these parameters
(Order order, double limitPrice, double stopPrice, int quantity, int filled, double averageFillPrice, OrderState orderState, DateTime time, ErrorCode error, string nativeError)
My code is like this:
private Order Short1 = null;
protected override void OnBarUpdate()
{
if (condition true)
{
EnterShortStopMarket(Convert.ToInt32(Target1Cont), (GetCurrentBid(0) + (StopOffsetShort * TickSize)) , @"Short1");
}
else if (
(condition false)
&& Order(Short1 = OrderState.TriggerPending))
{
CancelOrder(Short1);
}
}
....
protected override void OnOrderUpdate()
{
if (order.Name == Short1)
Short1 = order;
if (Short1 != null
&& Short1 == order)
if (Short1Order.OrderState == OrderState.Cancelled)
{
Short1 = null;
}
}
Comment