First of all the scenario involves using stocks/etf's for the portfolio.

Whether I use "Required Capital Assumptions in Margin Trader - Margin value 100% of contract cost" or "Potential Loss per Contract - Max Potential Loss 100" the results are the same.

Initial Capital: 1,000,000

Trade 1: (day 1) utilizes all 1,000,000 of capital

(day 2) Trade 1: appreciates by 45,000

Trade 2: (day 2) Trade 2: is entered utilizing the 45,000 of capital appreciation from Trade 1

To enter Trade 2, the account would need to borrow cash to place the trade, and go into margin greater than 100%. I would think, the max potential loss would be greater than 100% at that point in time (Trade 1 => 1,045,000 and Trade 2 => 45,000 == 1,090,000 potential loss).

I would think the Margin Value would be 1,090,000 / 1,045,000 == 104.3%

What I am suggesting is that at least one of these settings should be based on the cash curve (i.e. cash available).

Am I missing something?

# Portfolio Trader - Possible Margin Calculation Error

- Alex MultiCharts
**Posts:**194**Joined:**09 Aug 2013**Has thanked:**43 times**Been thanked:**76 times

- Alex MultiCharts
**Posts:**194**Joined:**09 Aug 2013**Has thanked:**43 times**Been thanked:**76 times

### Re: Portfolio Trader - Possible Margin Calculation Error

"Portfolio_Equity" value is calculated using the formula:

Portfolio_Equity = InitialCapital + Portfolio_NetProfit + Portfolio_OpenPositionProfit – TotalPotentialRiskCapital

InitialCapital - account state before trading start, set in Portfolio Settings.

Portfolio_NetProfit - current profit of all the portfolio. The sum of Net Profit for all the instruments (can be returned using "portfolio_netprofit" keyword).

Portfolio_OpenPositionProfit - current potential profit for all the portfolio. The sum of Open Position Profit for all the instruments (can be returned via "portfolio_openpositionprofit" keyword).

"TotalPotentialRiskCapital" value is the total number of already invested risk capital TotalPotentialRiskCapital (capital held in the trade/capital, that can be spent) for all the instruments:

TotalPotentialRiskCapital = ∑ PotentialRiskCapitalForSymbol for each symbol.

"PotentialRiskCapitalForSymbol" - total risk capital is calculated using the formula:

PotentialRiskCapitalForSymbol = ∑ PotentialRiskCapital for each ENTRY in POSITION.

Maximum potential loss per trade - "PotentialRiskCapital" is calculated as follows:

PotentialRiskCapital = Quantity*(MaxPotentialLossPerContract+MarginPerContract + CommVpc + SlippageVpc) + CommVpt + SlippageVpt;

Quantity – number of contracts;

CommVpt – commission value in Per Trade mode. If another mode is selected, then the value is equal to 0.

SlippageVpt – slippage value in Per Trade mode. If another mode is selected, then the value is equal to 0.

CommVpc – commission value in Per Contract mode. If another mode is selected, then the value is equal to 0.

SlippageVpc – slippage value in Per Contract mode. If another mode is selected, then the value is equal to 0.

So, capital excess might happen, as not only InitialCapital is taken into account, but also Portfolio_NetProfit + Portfolio_OpenPositionProfit.

Portfolio_Equity = InitialCapital + Portfolio_NetProfit + Portfolio_OpenPositionProfit – TotalPotentialRiskCapital

InitialCapital - account state before trading start, set in Portfolio Settings.

Portfolio_NetProfit - current profit of all the portfolio. The sum of Net Profit for all the instruments (can be returned using "portfolio_netprofit" keyword).

Portfolio_OpenPositionProfit - current potential profit for all the portfolio. The sum of Open Position Profit for all the instruments (can be returned via "portfolio_openpositionprofit" keyword).

"TotalPotentialRiskCapital" value is the total number of already invested risk capital TotalPotentialRiskCapital (capital held in the trade/capital, that can be spent) for all the instruments:

TotalPotentialRiskCapital = ∑ PotentialRiskCapitalForSymbol for each symbol.

"PotentialRiskCapitalForSymbol" - total risk capital is calculated using the formula:

PotentialRiskCapitalForSymbol = ∑ PotentialRiskCapital for each ENTRY in POSITION.

Maximum potential loss per trade - "PotentialRiskCapital" is calculated as follows:

PotentialRiskCapital = Quantity*(MaxPotentialLossPerContract+MarginPerContract + CommVpc + SlippageVpc) + CommVpt + SlippageVpt;

Quantity – number of contracts;

CommVpt – commission value in Per Trade mode. If another mode is selected, then the value is equal to 0.

SlippageVpt – slippage value in Per Trade mode. If another mode is selected, then the value is equal to 0.

CommVpc – commission value in Per Contract mode. If another mode is selected, then the value is equal to 0.

SlippageVpc – slippage value in Per Contract mode. If another mode is selected, then the value is equal to 0.

So, capital excess might happen, as not only InitialCapital is taken into account, but also Portfolio_NetProfit + Portfolio_OpenPositionProfit.