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.
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.
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.
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.
The current maintenance 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.
The current maintenance 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.
- When connected to the broker, the variables Balance, Equity, and MarginVal are retrieved from the broker API and valid for the whole account, not only for the trades of the current script. Trades that are entered manually or openend by another Zorro instance contribute to them.
- For simulating wins or losses that are not caused by trades, add the amount to WinTotal or LossTotal.
- The maximum risk and margin over all past bars is given by
RiskMax and MarginMax.
// stop trading when there's not enough money in the acount
if(IsTrading && Equity - MarginVal < 1000))
Lots = 0;
Lots = 1;
enterLong/Short, Win / Loss, Capital
► latest version online