I'd like to code a Position Sizing function that does the following:

Splits all available equity such that,
1) There is a minimum of M (e.g., 5) positions opened
2) No position is larger than D (e.g. $30,000) amount

I want no maximum # of positions.

Two examples:
A) $160,000 in equity, M = 5, D = $30,000, should be split such that 
I have,
-5 $30,000 positions
-1 $10,000 position

B) $100,000 in equity, M = 5, D = $30,000, should be split such that 
I have,
-5 $20,000 positions


Can this be done in AFL?
Thanks.

Reply via email to