Currently I am using the following to calculate the number of shares to trade in a strategy:
NumContracts = Floor (CurrentAccountSize / Close)
where CurrentAccountSize = AccountStartSize + NetProfit + PositionProfit
Essentially, I am saying use all available capital to trade.
I would now like to code a version that uses an allocated percentage of the IB account size as follows:
Code: Select all
Input:
PctAllocation(5)
Vars:
NumContracts(0)
NumContracts = Floor ((Net Liquidation Value of the IB account * (PctAllocation/100)) / Close)
Many thanks.