Account Parameters

Balance

The current amount in the broker account. In live trading, this parameter is updated from the broker API if available; otherwise it is calculated from Capital + Wintotal - LossTotal.

Equity

The current value of the account including all open trades. In live trading, this parameter is updated from the broker API if available; otherwise it is calculated from Balance + WinValTotal - LossValTotal.

TradeVal

The current value of all open trades by the strategy. This is the profit or loss if all trades would be closed immediately. The value of all open trades of the account is Equity - Balance.

RiskTotal

The estimated maximum risk of all open trades by the current script. The risk is estimated as trade costs plus loss at either the initial stop loss distance, or at an 1% adverse price move when no stop is used. Due to trailing and exit mechanisms, the real risk is normally smaller than the estimated risk, but can also be higher in cases of large price moves or large exit slippage.

MarginVal

The current allocated margin of all open trades of the account. The account is threatened by a margin call when Equity - MarginVal approaches zero. In live trading, this parameter is updated from the broker API if available; otherwise it is identical to MarginTotal.

MarginTotal

The current allocated margin of all open trades of the strategy. The backtest assumes that the margin requirement of an open trade remains constant until the trade closes. This can be different in live trading when brokers adapt the margin cost to the market situation or asset price. A margin call is simulated in test and train mode when Capital > 0 and Equity - MarginTotal reaches zero.

Range:

Account currency

Type:

var, read/only

Remarks:

Example:

// stop trading when there's not enough money in the acount
if(IsTrading && Equity - MarginVal < 1000)) 
Lots = 0;
else
Lots = 1;

See also:

enterLong/Short, Win / Loss, Capital

 

► latest version online