SetProfitTarget(CalculationMode.Percent, 0.025); SetStopLoss(CalculationMode.Percent, 0.01);
if (startTimeForLongExits < Times[0][0] && Times[0][0] <= endTimeForLongExits) ExitLong();
Everytime ExitLong gets called I get this error:
2023-07-25 12:33:28:616 (TD AMERITRADE) Cbi.Account.OrderUpdateCallback: realOrderState=Rejected orderId='8765432' account='erikreiter 098765' name='Sell' orderState=Rejected instrument='XXXX' orderAction=Sell limitPrice=0 stopPrice=0 quantity=60 orderType='Market' filled=0 averageFillPrice=0 time='2023-07-25 12:33:28' statementDate='2023-07-25' error=NoError comment='This order may result in an oversold/overbought position in your account. Please check your position quantity and/or open orders.' nr=-1
This is because the other the stop loss and profit target are real orders.
How do I fix this?
Thanks,
Erik
Comment