I am not able to test my strategy because cancel order is not working as expected.
I have my indicator and strategy running on 2500(primary data series) volume chart and added one tick secondary data series for order execution by calling unmanaged order methods on one tick bars.
Primary data series: 2500 volume
Secondary data series: 1 tick for order execution.
All the orders are place well ahead with limit price and based on market condition orders will be either modified or cancelled.
As per my understanding orders will be executed at the close of the bar (1 tick in this case).
But when I cancel the orders they are not getting cancelled at the end of one tick and they are getting cancelled at the end of 2500 bar.
Order entry and order modification methods getting executed as expected (end of one tick bar) but the cancel order is getting executed at the end of 2500 volume bar.
How do I execute the cancel order at the end of one tick bar?
Example of Order execution calls:
protected override void Initialize()
{
Add(PeriodType.Tick, 1); // secondary series for execution BarsInProgress == 1
CalculateOnBarClose = true;
Unmanaged = true;
IgnoreOverFill=true;
RealtimeErrorHandling = RealtimeErrorHandling.TakeNoAction;
}
Ord=SubmitOrder(1,OrderAction.Sell ……………);
ChangeOrder(Ord,……….);
CancelOrder(Ord);
OnExecution :
checking entry orders fill by comparing entry order object, submitting both stop and PT orders (OCO) and setting entry order to null.
Checking for PT order fill and setting PT order to null.
Checking for Stop order fill and setting it to null.
OnOrderUpdate:
Checking for Cancelled orders and setting appropriate objects to null (entry, PT or Stop)
Checking for Rejected orders and taking appropriate actions.
It will be great if you can help me to get the orders cancelled on the same data series as orders submitted.
Thanks,
gsreddy.
Comment