# Metrics
## Basic Metrics
- Profit and Loss (PNL)
- A financial metric that represents the overall gain or loss resulting from an investment or trading activity over a specific period.
- Total Trades
- Total trades refer to the overall number of trades executed by a trader or within a particular trading platform or exchange. It represents the cumulative count of all buying and selling transactions that have taken place within a given time period or across a specific set of assets.
- Winning Trades
- Winning trades in cryptocurrency trading refer to successful transactions that result in a profit for the trader. In other words, when a trader buys a cryptocurrency at a certain price and sells it later at a higher price, they have made a winning trade.
- Win Rate
- Represents the percentage of profitable trades or periods during the backtesting, indicating the strategy's success rate.
- Win rate is calculated by dividing the number of winning trades by the total number of all trades, and is often represented as a percentage.
- Loss Rate
- Loss rate is the number of losing trades divided by the total number of all trades, or 1 — win rate.
- Average Win
- Average win is calculated by taking the sum of all winning trades and dividing it by the number of winning trades.
- Average Loss
- Average loss is calculated by taking the sum of all losing trades and dividing it by the number of losing trades.
- Even the high winning rate trading system could still be a losing system bleeding your trading account.
- Profit Factor
- Compares the gross profit to the gross loss, indicating the strategy's profitability.
- A profit factor greater than 1 suggests that the strategy is profitable, while a value less than 1 indicates that the strategy is generating more losses than profits.
- Average Trade Duration
- Measures the average length of time a position is held in the strategy, providing insights into the trading frequency and potential liquidity requirements.
- Sharpe Ratio
- The Sharpe Ratio is a widely used metric that measures the reward-to-risk ratio of an investment strategy.
- It considers both the amount of reward (returns) and the amount of risk taken.
- The formula divides the excess return (return above the risk-free rate) by the standard deviation of returns.
- Standard deviation represents the volatility or spread of returns, indicating the potential for losses and emotional volatility.
- The risk-free rate is a benchmark representing the return from a risk-free investment, such as treasury yields.
- The square root of n is used to annualize the Sharpe Ratio, making it consistent and comparable across different time periods.
- Annualizing ensures that strategies with different sampling intervals (e.g., minute, hourly, daily) can be compared easily.
- The implementation involves calculating the returns from account values, taking their mean, multiplying by the annualization coefficient, and dividing by the annualized standard deviation.
- A good Sharpe Ratio is typically greater than 1, indicating that the strategy provides more reward for each unit of risk taken.
- A Sharpe Ratio of 2 or higher is considered excellent.
- Care should be taken to properly apply the annualization coefficient in the numerator and denominator of the formula.
- Sortino Ratio
- The Sortino Ratio is similar to the Sharpe Ratio but focuses only on negative returns, specifically downside risk.
- It measures the reward-to-downside-risk ratio, emphasizing the avoidance of large losses.
- The implementation is similar to the Sharpe Ratio, but instead of considering all standard deviations of returns, only negative returns are used.
- The Sortino Ratio is calculated by dividing the excess return (return above the risk-free rate) by the standard deviation of negative returns.
- When deciding between Sharpe and Sortino, consider the specific objective. Sharpe Ratio provides an overall measure of volatility, while Sortino Ratio focuses on reducing negative downside risk and emotional volatility.
## Advanced Metrics
- Cumulative Return
- Measures the total percentage change in the value of the investment over the backtesting period.
- Compound Annual Growth Rate (CAGR)
- CAGR represents the average annual growth rate needed for an investment to achieve its cumulative return.
- It allows for easy comparison of returns across different strategies and benchmarks.
- To calculate CAGR, divide the final value of an investment by the initial value, take the nth root of the result (n is the number of years), subtract 1, and multiply by 100.
- CAGR helps determine the annual return of a portfolio and enables comparison with benchmarks like the S&P 500.
- Implementation of the CAGR formula is straightforward when start and end balances are known.
- CAGR is particularly useful for comparing strategies with different time periods during backtesting.
- A "good" CAGR depends on the benchmark or desired returns and can be compared to other investments such as real estate or crypto defi rates.
- Maximum Drawdown
- Maximum drawdown is the largest drop between a peak and a trough in trading or strategy.
- It indicates the biggest loss a strategy incurred over a period of time.
- Maximum drawdown helps evaluate the duration and magnitude of losing periods.
- The implementation involves calculating cumulative product of returns and identifying peaks.
- The drawdown is then obtained by comparing cumulative values with peaks.
- A good drawdown is one that is closer to 0, indicating smaller losses.
- Typically, a drawdown of less than 10% is considered impressive.
- Value-At-Risk
- Value-at-Risk (VaR) is a metric that measures the maximum amount of capital at risk in a portfolio at any given time.
- VaR helps estimate the potential loss within a certain confidence interval.
- There is no direct formula for VaR, but it involves creating a normal distribution of returns and determining the associated confidence interval.
- Sorting returns from negative to positive helps create a natural normal distribution.
- VaR is implemented by calculating the initial account value, sorting returns, and selecting the appropriate value based on the confidence interval.
- The output of VaR is in the unit of the asset being measured.
- Higher VaR indicates greater risk and raises concerns about individual trades.
- Minimizing VaR is desirable for risk management and peace of mind.
- Beta
- Beta is a metric that measures the volatility or systematic risk of a strategy relative to a benchmark or base asset.
- It compares the returns of the strategy to those of the benchmark.
- A higher beta indicates higher volatility and more systematic risk, while a beta closer to one implies alignment with the base asset.
- A beta less than one suggests lower volatility and potentially better risk management.
- The beta calculation involves covariance and standard deviation calculations between strategy returns and benchmark returns.
- Beta is important as it helps assess whether a strategy outperforms the market while managing risk.
- It provides a holistic view when combined with other metrics in evaluating trading models.
-
- Risk of Ruin
- Estimates the probability of depleting the trading capital, indicating the risk of total loss under adverse market conditions.
- Risk-Adjusted Return
- Evaluates the investment return considering the level of risk taken, often using metrics like the Sortino ratio or Calmar ratio.
- Benchmark Comparison
- Compares the performance of the strategy to a benchmark index or other relevant benchmarks, such as Bitcoin or a specific cryptocurrency market index.
- Statistical Expectancy
- Makes use of the win rate, loss rate, average gain, and average loss is statistical expectancy.
- Expectancy = Net of all trades / Total number of trades or (Win rate x Average win) — (Loss rate x average loss)
- This is useful because in order to analyze our trade plans, we need to include not only win rate, average wins and losses, and profit factor (to determine that we have a winning plan), but we need to add expectancy and number of trades in order to determine exactly how profitable we expect the plan to be over time.
- Expectation
- Expectation reflects how robust a trading plan is by measuring how sensitive it is to changes in average loss.
- Formula: Expectation = Expectancy / Average loss
- Some good rules of thumb for expectation are:
- If expectation is less than 0, then the expectancy (gain per trade) must be less than 0 and it is a losing plan that should not be traded.
- If expectation is between 0 and 0.5, then the plan is OK, but we should monitor our losses to make sure the average does not significantly change (get greater).
- If expectation is greater than 0.5, then we have a robust trading plan.
---
References/Other notes:
<a id="1">[1]</a> [Trading Algos - 5 Key Backtesting Metrics and How to Implement Them](https://blankly.finance/list-of-performance-metrics/)
<a id="1">[2]</a> [10 Numbers Every Trader Should Know](https://medium.com/@netpicks/10-numbers-every-trader-should-know-dd900cf84366)