Sometimes I forget live orders out and when I get filled, usually I dont want the fill any longer. But I also dont want to have to manually do this, this has to be done automatically, for everything except GTC orders
I'm assuming these aren't API orders because if they are you can just cancel them with code. It might be possible to cancel open orders with the API, even if you didn't use the API to submit them, but I am not 100% sure of this. Or have a keyboard macro program fire off Alt+T + Alt+N + Alt+O (which cancels all open orders) to the TWS window after 30 minutes. Maybe use a program like "autoit" and then use a script that involves a timer: https://www.autoitscript.com/forum/topic/81919-setting-up-a-timer/
Code: class KillEmAll(EWrapper): def __init__(self): self.connection = EClientSocket() def reqAllOpenOrders(self): self.connection.reqAllOpenOrders() def openOrder(self, orderId, contract, order, state): self.connection.cancelOrder(orderId) untested but call reqAllOpenOrders after 30 minutes and the results comeback in openOrder
you can define the 'time in force' in the order ticket. This will end teh ticket after the mentioned end time. Use teh GTD setting
That's python code calling the API. If you're not a programmer it won't mean anything to you. As far as making TWS do it without programming the best you can do is make everything day orders. At least they'll get canceled after market close.
Have you looked at OCA (One Cancels All) orders? You assign the related orders to an OCA group and if 1 fills the others are canceled immediately.