Code: Select all
buytocover all contracts next bar at market;
sell all contracts next bar at market;
Code: Select all
buytocover all contracts next bar at market;
sell all contracts next bar at market;
I use a similar code segment, but I'm more comfortable resubmitting them every tick while there is a market position. In theory, they should also work when you only submit them once (i.e. for a one tick duration with IOG), but just in cause the order doesn't get through or there is some other quirk, I just keep resubmitting them until the market position is indeed flat.What does everyone now use to cover all their existing positions in a strategy? I've been using:and only execute these two statements once, not on every update tick or recalculation (using RecalcLastBarAfter). Is this still the correct approach, or is there yet another undocumented keyword to achieve the same thing in one go? As I stated I only execute them once since I've noticed some time ago during my stress tests a strange but very rare occurrence. if I executed them every time, I eventually may get a long or short opened for no apparent reason.Code: Select all
buytocover all contracts next bar at market;
sell all contracts next bar at market;