I'm trying to figure out the best way to implement simultaneously trade long and short strategies using the same underlying, but may not always be mutually exclusive in terms of when they are in the market.
In other words, I have a long strategy that scales into the market by beinning with an entry limit order, then keeps track of average price to scale in by buying again 2 to 3 more times at lower prices. When an exit signal occurs, the entire position is sold.
I have similar strategies for short trades - but I don't want them to be mutually exclusive. If I'm in a long trade and a short starts to be put on - I want the NET exposure to be the net of the long and short positions.
The table below summarizes what I'm talking about for the following transacction stream:
1. At time 1 buy 100 XYZ
2. At time 2 buy 100 XYZ
3. While in the long trade, new short trade to sell 100 XYZ
4. Exit Long trade (1 and 2).
5. Exit Short Trade
Long Short Net
100 0 100
200 0 200
200 -100 100
0 -100 -100
0 0 0
Remember, I'm going to have to scale in for both longs and shorts. Any ideas code examples greatly appreciated!
John
Comment