Hi,
So I have a very simple algo that purchases XB futures and sells CL futures every day, 30 minutes after market open.
Rightly so, there would be some slippage etc and many lots wouldn't get filled at the bid or ask price in reality.
Currently my algo is getting varying volumes of XB and CL executed every day.
However - I do not want my algo to ever hold an uneven number of lots of the two different contracts. I always want to be :
Long X lots of XB
Short Y lots of CL
Where X = Y at all times, whether X = 5, 1000 or 0.
How can I implement this smoothly?