Performance Metrics Glossary
Profit Metrics
| Metric | Description |
|---|---|
| Net Profit | Total profit after all costs (slippage, commission) |
| Gross Profit | Sum of all winning trades |
| Gross Loss | Sum of all losing trades |
| Profit Factor | Gross Profit / Gross Loss (>1.0 is profitable) |
| Average Trade | Net Profit / Total Trades |
Win/Loss Metrics
| Metric | Description |
|---|---|
| Win % | Percentage of trades that were profitable |
| Average Winner | Mean profit of winning trades |
| Average Loser | Mean loss of losing trades |
| Largest Winner | Best single trade |
| Largest Loser | Worst single trade |
| Avg Win / Avg Loss | Payoff ratio |
Risk-Adjusted Returns
| Metric | Description |
|---|---|
| Sharpe Ratio | (Annualised Return - Risk Free Rate) / Annualised Volatility |
| Sortino Ratio | Like Sharpe, but uses only downside volatility |
| Calmar Ratio | Annualised Return / Maximum Drawdown |
| RINA Index | Risk-adjusted metric that rewards consistency |
| Ulcer Index | Measures the depth and duration of drawdowns |
Drawdown Metrics
| Metric | Description |
|---|---|
| Maximum Drawdown | Largest peak-to-trough equity decline |
| NP/DD | Net Profit / Maximum Drawdown |
| Recovery Factor | Net Profit / Maximum Drawdown (same as NP/DD) |
Equity Curve Quality
| Metric | Description |
|---|---|
| R-Squared | Linearity of the equity curve (1.0 = perfectly linear growth) |
| Pearson Correlation | Correlation between trade sequence and cumulative profit |
Time In Market
| Metric | Description |
|---|---|
| Percentage Of Time In Market (per-run) | Fraction of post-warmup bars during which at least one position was open. |
| Percentage Of Time In Market (combined) | Fraction of wall-clock time during which at least one position was open in any symbol/strategy run, divided by the union of tradable wall-clock time across all runs. Captures true portfolio exposure: simultaneous positions in two runs count as one in-market interval, not two. |
| Capital-Weighted Time In Market (combined) | Allocation-weighted average capital utilisation across runs. For futures, the static MarginPerContract is converted to a margin fraction using the most recent bar’s notional (LastBarPrice * PointValue) and applied backward to each historical trade using its average price, so the dollar margin requirement scales with contract value over time. For stocks/ETFs (where MarginPerContract == 0), the full notional is the deployed capital (margin fraction = 1.0). Per-run utilisation is mean(deployed)/peak(deployed) over the post-warmup bar grid; the combined value is the peak-allocated-capital-weighted mean of per-run utilisation. Reflects how busy each run keeps its allocated capital, weighted by run size. |
Account-Equity Graph (Time-Based X Axis)
The graph output mode displays two stacked ASCII panels where the X axis represents equal time periods rather than equal numbers of trades. This means each unit of horizontal space corresponds to the same amount of calendar time, making it easy to see when trades occurred and how performance varied over different market periods.
Top panel — Account Equity. The curve shows initial capital + cumulative closed P&L + open mark-to-market, in the base currency, anchored to a horizontal initial-capital reference line. Including open mark-to-market lets the curve reflect unrealized gains and losses while a position is held; the previous closed-P&L-only curve produced a flat segment that suddenly jumped on trade exit.
Bottom panel — Capital Utilization. Three series in the base currency: free cash, futures margin set aside, and stock capital (cost basis of open longs plus locked short proceeds). The three sum to total account equity at any point in time. Series that are identically zero across the run (e.g. margin in a stocks-only backtest) are omitted.
Trades entered during the indicator warmup period (before max-bars-back bars have been processed) are excluded from the equity curve and the monthly returns table. The graph itself is trimmed to start from the first tradable bar (after warmup), so no flat zero-line appears during the warmup period. The time-based period splitting also starts from the first tradable bar, not from the backtest start date.
The post-warmup backtest period is divided into equal calendar periods:
- Monthly periods when the backtest spans 5 years or fewer
- Yearly periods when the backtest spans more than 5 years
Each period is allocated an equal share of the graph width. Within each period, daily equity values are downsampled (when there are more days than allocated graph points) or interpolated via step function (when there are fewer days). For margin and stock-capital curves, downsampling preserves peak values within each bucket to avoid underrepresenting capital tied up.
Custom Metrics
Algolang supports custom fitness expressions using the ExprTK mathematical expression library. The following 24 variables are available in fitness expressions:
avgtrade, calmar, car, carbh, mar, mar12roll, nbrtrades, netprofit, npdd, npmargin, pearson, pctindd, pctpm, pctpq, pctpy, profitfactor, profsegs10, r2, rina, sharpe, sortino, tsindex, ulcer
Expressions support arithmetic (+, -, *, /, ^), comparison (<, >, ==), logical operators (and, or, not), and functions (abs, sqrt, min, max, if, clamp).
Example: --fitness-metric "sharpe * r2" (Sharpe ratio weighted by equity curve linearity).
For the full variable reference, expression syntax guide, and additional examples, see the “Custom fitness expressions” section under “Optimisation with seek”.