Title here
Summary here
Whale‑E exposes read-only built-in variables for performance metrics, position information, and candle data.
| Variable | Description |
|---|---|
initial_capital | The starting capital of the backtest. Constant for the whole backtest (set at initialization). |
equity | The current equity of the portfolio, calculated as initial_capital + netprofit + openprofit.Recomputed when the engine revalues open positions at market price, on every closed candle, and after each order execution or liquidation. |
netprofit | The realized net profit of the strategy. Updated whenever a position is closed or liquidated. Its final value is the sum of realized gains and losses. |
grossprofit | The sum of realized gains from winning closed positions. Updated whenever a position close or liquidation realizes a gain. |
grossloss | The sum of realized losses from losing closed positions, expressed as a positive value. Updated whenever a position close or liquidation realizes a loss. |
openprofit | The unrealized profit or loss on open positions. Recomputed when the engine revalues open positions at market price, on every closed candle, and after each order execution or liquidation. |
openprofit_percent | The unrealized profit or loss on open positions, as a percentage of realized equity. Recomputed when the engine revalues open positions at market price, on every closed candle, and after each order execution or liquidation. |
grossprofit_percent | The sum of realized gains from winning closed positions, expressed as a percentage of initial capital. Updated whenever a position close or liquidation realizes a gain. |
grossloss_percent | The sum of realized losses from losing closed positions, expressed as a percentage of initial capital. Updated whenever a position close or liquidation realizes a loss. |
avg_winning_trade | The average profit of winning trades. Updated on each winning close or liquidation. |
avg_losing_trade | The average loss of losing trades. Updated on each losing close or liquidation. |
avg_winning_trade_percent | The average profit of winning trades, expressed as a percentage of the closed position’s entry value, including fees. Recomputed on each recorded close (including partial closes and liquidations). |
avg_losing_trade_percent | The average loss of losing trades, expressed as a percentage of the closed position’s entry value, including fees. Recomputed on each recorded close (including partial closes and liquidations). |
avg_trade | The average profit or loss of all trades. Recomputed on each recorded close (including partial closes and liquidations). |
avg_trade_percent | The average profit or loss of all trades, expressed as a percentage of the closed position’s entry value, including fees. Recomputed on each recorded close (including partial closes and liquidations). |
closedtrades | The total number of closed trades. Incremented on each recorded close (including partial closes and liquidations). |
opentrades | The current number of open trades. Updated on each entry, close, or liquidation. |
max_drawdown | The maximum drawdown of the strategy. Updated on every candle (using high/low extremes and close) and on realized PnL updates. |
max_drawdown_percent | The maximum drawdown of the strategy, as a percentage from a peak equity value. Updated on every candle (using high/low extremes and close) and on realized PnL updates. |
max_runup | The maximum run-up of the strategy. Updated on every candle from intrabar extremes. |
max_runup_percent | The maximum run-up of the strategy, as a percentage from a trough equity value. Updated on every candle from intrabar extremes. |
These variables describe the executing grid.
| Variable | Description |
|---|---|
ticker | Primary market symbol used for the backtest (e.g. BTCUSDT).Constant during the whole backtest execution. |
tickerid | Full exchange:symbol identifier (e.g. BINANCE:BTCUSDT).Constant during the whole backtest execution. |
These variables describe the current position.
| Variable | Description |
|---|---|
position_avg_price | The average entry price of the current position. Recomputed on position entries and scale-ins, kept unchanged on partial scale-outs, and reset to NaN when the position becomes flat. |
margin_liquidation_price | The estimated liquidation price for the current position. Recomputed when position size or margin settings change, and reset to NaN when the position becomes flat or margin is disabled. |
These variables are time series that expose the OHLCV data of the current candle.
Note on series and indexing
close, is equivalent to close[0].close[1] returns the previous candle, close[2] the one before, and so on.NaN.| Variable | Description |
|---|---|
open | The opening price of the current candle. Updated on each newly closed candle of the main timeframe. |
high | The highest price of the current candle. Updated on each newly closed candle of the main timeframe. |
low | The lowest price of the current candle. Updated on each newly closed candle of the main timeframe. |
close | The closing price of the current candle. Updated on each newly closed candle of the main timeframe. |
volume | The volume of the current candle. Updated on each newly closed candle of the main timeframe. |
hl2 | The average of the high and low prices of the current candle. Updated on each newly closed candle of the main timeframe. |
hlc3 | The average of the high, low, and closing prices of the current candle. Updated on each newly closed candle of the main timeframe. |
ohlc4 | The average of the opening, high, low, and closing prices of the current candle. Updated on each newly closed candle of the main timeframe. |
hlcc4 | The average of the high, low, and twice the closing price of the current candle. Updated on each newly closed candle of the main timeframe. |