Position Size issue with available capital

Questions about MultiCharts and user contributed studies.
smhuggins
Posts: 12
Joined: 15 Mar 2015
Has thanked: 1 time

Position Size issue with available capital

Postby smhuggins » 04 May 2022

Hi,
I need help with Portfolio Trader and limiting the trade size to the specified position sizing.

If I set position size at 5% of portfolio equity, the backtest generates trades to fill the remaining available equity at trade sizes SMALLER than the position size.

I want the backtest to ONLY take trades at the specified position size, eg 5% of portfolio equity (and if there is NOT enough available capital/buying power then do not take the trade).

I have tested both coding the position size AND using Portfolio Traders in built 'Percent of Equity' Trade size but both generate trade sizes at LESS than the trade size specified.

When I check this against a 'fixed shares of 100' the backtest ONLY takes trades at 100 shares (it doesn't take less). So it seems there I have a calculation or setting error wrong ??

I use these settings in Portfolio Settings:

Exposure (% of Portfolio Capital): 100%
Max % of Capital at Risk per Position: 100%
Initial Capital: 100,000
Margin Value: 100%
Max Potential Loss: 0%

I have tried making a condition with this line of code but it doesn't fix it - I still get trades at LESS than the position size:

Code: Select all

Positionsize = (Portfolio_Equity * PcntEquity / close / 100 ) ; Condition1 = ( Portfolio_Equity - Portfolio_InvestedCapital ) > ( PositionSize * close )

Is there a setting or line of code I am missing somewhere?

Thanks
Simone

Return to “MultiCharts”