My strategy is returning an 'order rejected' message and shutting itself down due to my OCO order residing on IB servers while the strategy tries to exit the position at market.
Please see the following excerpts of my code:
SetProfitTarget(CalculationMode.Percent, sellLimit);
SetStopLoss(CalculationMode.Percent, sellStop);
and
if ((ToTime(Time[0]) >= ToTime(9, 59, 0)))
{
ExitLong("Exit", "Enter");
}
When the second part is called WHILE the OCO (stop loss and profit target) is still active on IB's end, the strategy shuts itself down.
Is there a way to have NT cancel the stop loss and profit targets prior to submitting the ExitLong order so that this doesn't occur?
Or is there any other way to solve this?
Thanks a lot,
Zuhayr
Comment