Profile Picture

Cancelled order resubmitted

Posted By alpha23 5 Years Ago
Message
Posted Wednesday February 08 2012
I tried cancelling orders via order.CancelOrder() but the TWSplugin seems to resubmit it automatically. Below is the tws log for 2 symbols PFE and OKE. After each are cancelled - verified in TWS - PFE is resubmitted at 13:25:33.2841 and OKE is resubmitted at 13:25:39.8992.

Please advise.

Thanks, Duane

2012-02-08 13:23:24.1616   PFE   45010   n/a   SubmitOrder   45010: Market On Close Sell PFE 0/668 - Submitted
2012-02-08 13:23:29.4759   PFE   45009   42   CancelOrder   Cancelling order
2012-02-08 13:23:29.5179   OKE   45011   n/a   SubmitOrder   45011: Market On Close Sell OKE 0/171 - Submitted
2012-02-08 13:23:58.3046   OKE   45008   45   CancelOrder   Cancelling order
2012-02-08 13:24:06.8992   PFE   45009   42   IB error/warning   202: Order Canceled - reason:
2012-02-08 13:24:06.9314   PFE   45009   42   OrderStatusApiCanceled   Order status updated
2012-02-08 13:24:06.9314   OKE   45011   n/a   OrderStatusPendingCancel   Order status updated
2012-02-08 13:24:06.9314   OKE   45011   n/a   IB error/warning   202: Order Canceled - reason:
2012-02-08 13:24:06.9314   OKE   45011   n/a   OrderStatusApiCanceled   Order status updated
2012-02-08 13:24:06.9666   PFE   45010   n/a   OrderStatusPendingCancel   Order status updated
2012-02-08 13:24:06.9666   PFE   45010   n/a   IB error/warning   202: Order Canceled - reason:
2012-02-08 13:24:06.9666   PFE   45010   n/a   OrderStatusApiCanceled   Order status updated
2012-02-08 13:24:06.9666   OKE   45008   45   IB error/warning   202: Order Canceled - reason:
2012-02-08 13:24:06.9803   OKE   45008   45   OrderStatusApiCanceled   Order status updated
2012-02-08 13:24:06.9803   n/a   2147483647   n/a   IB error/warning   321: Error validating request:-'kb' : cause - The account code is required for this operation.
2012-02-08 13:25:33.2841   PFE   45012   42   SubmitOrder   45012: Limit Sell PFE @ 21.5 0/668 - Submitted
2012-02-08 13:25:39.8992   n/a   2147483647   n/a   IB error/warning   321: Error validating request:-'kb' : cause - The account code is required for this operation.
2012-02-08 13:25:39.8992   OKE   45013   45   SubmitOrder   45013: Limit Sell OKE @ 84.25 0/171 - Submitted
2012-02-08 13:25:39.9324   PFE   45012   42   OrderStatusSubmitted   Order status updated
2012-02-08 13:25:40.1101   OKE   45013   45   OrderStatusSubmitted   Order status updated
Posted Tuesday February 14 2012
It looks like you are cancelling profit target orders, and RightEdge is resubmitting them for you. You probably want to handle profit targets and stop losses differently. You can look at the TradeType property of the Order to determine whether it is a profit target/stop loss. If you want to cancel the profit target entirely, call pos.SetProfitTarget(0, TargetPriceType.None).

Thanks,
Daniel
Posted Tuesday February 14 2012
Daniel,

Yes, you are correct.

Thanks, that should fix the problem.

Duane


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems