Exiting unfilled GTC orders per script

Posted By: MegaTanker

Exiting unfilled GTC orders per script - 07/12/22 18:56

in run(), I check if a GTC order is unfilled in a trade enumeration loop. If it is, I want to cancel it. I tried doing exitTrade(ThisTrade) but I've noticed that Zorro then tries to "close" this position by sending another order with Amount = 0 through BrokerBuy2 (NFA), when in reality it should simply cancel the order and not place another one. DO_CANCEL is implemented for that purpose but not called here.

Is there a correct way of canceling GTC orders that are completey unfilled thus far? (without using OrderDuration)
Posted By: jcl

Re: Exiting unfilled GTC orders per script - 07/13/22 08:33

Call DO_CANCEL directly. exitTrade would also close any partially filled amount.

It was already suggested that we implement easier order control. This will be done in a future version.
Posted By: MegaTanker

Re: Exiting unfilled GTC orders per script - 07/13/22 10:19

Alright, thanks. That is good to hear
© 2024 lite-C Forums