You don’t need to do any math.
CountOfLongShares and CountOfShortShares return the data you need. Since you cannot have Long and Short trades opened at the same time, that’s all you need.
CountOfPosition returns the same data, but as a positive number for Long trades and negative numbers for Short trades (you may use ABS() to work this around).
They return data relative to the current strategy, since knowing what other strategies do is not currently supported.
1 user thanked author for this post.