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 on each mark-to-market update, on every closed candle, and after each order execution or liquidation. |
netprofit | The net profit of the strategy. Updated on each realized PnL event (close or liquidation), then recomputed at the end of the backtest. |
grossprofit | The gross profit of the strategy. Updated on each close or liquidation with positive realized PnL. |
grossloss | The gross loss of the strategy. Updated on each close or liquidation with negative realized PnL. |
openprofit | The unrealized profit or loss on open positions. Recomputed on each mark-to-market update, 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 on each mark-to-market update, on every closed candle, and after each order execution or liquidation. |
grossprofit_percent | The gross profit of the strategy, as a percentage of the initial capital. Updated whenever grossprofit is updated (winning close or liquidation). |
grossloss_percent | The gross loss of the strategy, as a percentage of the initial capital. Updated whenever grossloss is updated (losing close or liquidation). |
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, as a percentage of the trade’s cost basis. Recomputed on each recorded close (including partial closes and liquidations). |
avg_losing_trade_percent | The average loss of losing trades, as a percentage of the trade’s cost basis. 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, as a percentage of the trade’s cost basis. 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 provide access to the OHLCV data of the current candle.
Note on series and indexing
close) returns 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. |