Account variables reference

All 13 account variables in AlgoBarsX, each with its parameters, defaults, ranges and an example: account.balance, account.equity, account.margin, account.free_margin, account.margin_level, account.currency, account.leverage, account.mode, account.venue, positions and 3 more.

account.balance account.equity account.margin account.free_margin account.margin_level account.currency account.leverage account.mode account.venue positions orders trades history

account.balance→ money#

Account balance.

Example
bal = account.balance
strategyindicatoralertsince 1.0

account.equity→ money#

Balance plus open profit and loss.

Example
eq = account.equity
strategyindicatoralertsince 1.0

account.margin→ money#

Margin in use.

Example
used = account.margin
strategyindicatoralertsince 1.0

account.free_margin→ money#

Margin available.

Example
available = account.free_margin
strategyindicatoralertsince 1.0

account.margin_level→ percent#

Equity as a percentage of margin.

Example
level = account.margin_level
strategyindicatoralertsince 1.0

account.currency→ string#

Account currency.

Example
ccy = account.currency
strategyindicatoralertsince 1.0

account.leverage→ number#

Account leverage.

Example
lev = account.leverage
strategyindicatoralertsince 1.0

account.mode→ string#

demo or live.

Example
is_live = account.mode == "live"
strategyindicatoralertsince 1.0

account.venue→ string#

house, metatrader, ibkr or a broker name.

Example
where = account.venue
strategyindicatoralertsince 1.0

positions→ list<Trade>#

Open positions on the account, filterable by symbol, side and source.

Example
open_count = positions.len
strategyindicatoralertsince 1.0

orders→ Orders#

Pending orders on the account.

Example
waiting = orders.pending(tag: "grid")
strategyindicatoralertsince 1.0

trades→ Trades#

The strategy's own trades: open(), closed(), last().

Example
mine = trades.open()
strategysince 1.0

history→ History#

Closed trades with aggregates such as pnl, win_rate and profit_factor.

Example
today_pnl = history.today.pnl
strategyindicatoralertsince 1.0

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account