Key Concepts

Glossary

alpha

The excess return of an algorithm relative to its benchmark after adjusting for risk. Alpha measures the value added by the algorithm's strategy beyond what could be explained by exposure to market movements.

It is calculated as

$$ \alpha = R_p - \left[ R_f + \beta \left( R_b - R_f \right) \right] $$

where $R_p$ is the portfolio return, $R_f$ is the risk-free rate, $\beta$ is the portfolio's beta, and $R_b$ is the benchmark return. A positive alpha indicates the algorithm outperformed its risk-adjusted benchmark.

annual standard deviation

A statistical measure that describes the dispersion of annual returns relative to the mean annual return. It is the square root of the annual variance. Assuming independent and identically distributed daily returns, it is calculated as

$$ \sigma_{\text{annual}} = \sigma_{\text{daily}} \times \sqrt{252} $$

where $\sigma_{\text{daily}}$ is the standard deviation of daily returns and 252 is the typical number of trading days in a year.

annual variance

A statistical measure that describes the dispersion of annual returns relative to the mean annual return. Assuming independent and identically distributed daily returns, it is calculated as

$$ \sigma^2_{\text{annual}} = \sigma^2_{\text{daily}} \times 252 $$

where $\sigma^2_{\text{daily}}$ is the variance of daily returns and 252 is the typical number of trading days in a year.

average loss

The average rate of return for unprofitable trades.

It is calculated as

$$ \bar{L} = \frac{1}{n_L} \sum_{i=1}^{n_L} R_i $$

where $n_L$ is the number of unprofitable trades and $R_i$ is the return of each unprofitable trade.

average win

The average rate of return for profitable trades.

It is calculated as

$$ \bar{W} = \frac{1}{n_W} \sum_{i=1}^{n_W} R_i $$

where $n_W$ is the number of profitable trades and $R_i$ is the return of each profitable trade.

beta

The scale and direction of an algorithm's returns relative to movements in the underlying benchmark.

It is calculated as

$$ \beta = \frac{\text{Cov}(R_p,\, R_b)}{\text{Var}(R_b)} $$

where $R_p$ is the portfolio return and $R_b$ is the benchmark return. A beta of 1 indicates the algorithm moves in lockstep with the benchmark, a beta greater than 1 indicates amplified movements, and a negative beta indicates inverse movements.

capacity

The maximum amount of money an algorithm can trade before its performance degrades from market impact. Capacity is determined by the liquidity of the assets the algorithm trades and the size of positions it takes.

compounding annual return

The annual percentage return that would be required to grow a portfolio from its starting value to its ending value.

It is calculated as

$$ \text{CAGR} = \left(\frac{e}{s}\right)^{\frac{1}{y}} - 1 $$

where $s$ is starting equity, $e$ is ending equity, and $y$ is the number of years in the backtest period.

day trade

Buying and selling the same asset within one trading day. In the US Equity market, the Financial Industry Regulatory Authority (FINRA) monitors day trading activity and enforces the pattern day trader rule.

drawdown

The largest peak to trough decline in an algorithm's equity curve.

It is calculated as

$$ 1 - \frac{v^{t \ge s}_{\text{min}}}{v^s_{\text{max}}} $$

where $v^s_{\text{max}}$ is the maximum equity value up to time $s$ and $v^{t \ge s}_{\text{min}}$ is the minimum equity value at time $t$ where $t \ge s$.

equity

The total portfolio value if all of the holdings were sold at current market rates. Equity equals the sum of cash and the market value of all open positions.

expectancy

The expected return per trade.

It is calculated as

$$ E = (W_r \times \bar{W}) + (L_r \times \bar{L}) $$

where $W_r$ is the win rate, $\bar{W}$ is the average win, $L_r$ is the loss rate, and $\bar{L}$ is the average loss. A positive expectancy indicates the algorithm is expected to be profitable over time.

holdings

The absolute sum of the items in the portfolio. Holdings represent the total market value of all positions, regardless of whether they are long or short.

implied volatility

The volatility of an Option's underlying asset that, when input into an Options pricing model, returns a theoretical value equal to the current market price of the Option.

An initial estimate can be calculated as

$$ \sigma \approx \frac{P}{S} \sqrt{\frac{2\pi}{T}} $$

where $P$ is the Option price, $S$ is the underlying asset price, and $T$ is the time to expiration in years. For more information, see Brenner and Subrahmanyam (1988).

information ratio

The amount of excess return relative to the benchmark per unit of tracking error.

It is calculated as

$$ IR = \frac{R_p - R_b}{\sigma_{R_p - R_b}} $$

where $R_p$ is the portfolio return, $R_b$ is the benchmark return, and $\sigma_{R_p - R_b}$ is the tracking error (the standard deviation of the difference between the portfolio and benchmark returns). A higher information ratio indicates more consistent outperformance.

intrinsic value

(Call Option) The price of an asset minus the strike price if the price is above the strike price, otherwise zero.

It is calculated as

$$ IV_{\text{call}} = \max(S - K,\, 0) $$

(Put Option) The strike price minus the price of an asset if the price is below the strike price, otherwise zero.

It is calculated as

$$ IV_{\text{put}} = \max(K - S,\, 0) $$

where $S$ is the current price of the underlying asset and $K$ is the strike price of the Option contract.

look ahead bias

The practice of making decisions using information that would not be available until some time in the future. Look-ahead bias invalidates backtest results because the algorithm uses data it would not have access to in live trading.

loss rate

The proportion of trades that were not profitable.

It is calculated as

$$ L_r = \frac{n_L}{N} $$

where $n_L$ is the number of unprofitable trades and $N$ is the total number of trades. The loss rate equals $1 - W_r$, where $W_r$ is the win rate.

lowest capacity asset

The asset an algorithm traded that has the lowest capacity. This asset acts as the bottleneck that limits the total capital the algorithm can deploy without degrading performance.

net profit

(Percent) The rate of return across the entire trading period.

It is calculated as

$$ \text{Net Profit (\%)} = \frac{e - s}{s} \times 100 $$

(Dollar-value) The dollar-value return across the entire trading period.

It is calculated as

$$ \text{Net Profit (\$)} = e - s $$

where $s$ is starting equity and $e$ is ending equity.

out of the money amount

(Call Option) The strike price minus the price of an asset if the price is below the strike price, otherwise zero.

It is calculated as

$$ OTM_{\text{call}} = \max(K - S,\, 0) $$

(Put Option) The price of an asset minus the strike price if the price is above the strike price, otherwise zero.

It is calculated as

$$ OTM_{\text{put}} = \max(S - K,\, 0) $$

where $S$ is the current price of the underlying asset and $K$ is the strike price of the Option contract.

pattern day trader

A trader who executes four or more day trades in the US Equity market within five business days. FINRA requires pattern day traders to maintain a minimum account equity of $25,000.

payoff

The profit or loss that an Option buyer or seller makes from a trade. Payoff is determined by the difference between the Option's intrinsic value at expiration and the premium paid or received.

Pearson correlation

A measure of the linear relationship between two variables, ranging from -1 to 1.

It is calculated as

$$ \rho_{XY} = \frac{\text{Cov}(X,\, Y)}{\sigma_X \sigma_Y} $$

where $\text{Cov}(X, Y)$ is the covariance of the two variables and $\sigma_X$, $\sigma_Y$ are their standard deviations. A value of 1 indicates a perfect positive linear relationship, -1 indicates a perfect negative linear relationship, and 0 indicates no linear relationship.

Probabilistic Sharpe ratio

The probability that the estimated Sharpe ratio of an algorithm is greater than a benchmark.

It is calculated as

\[ P\left(\hat{SR} > SR^{\ast}\right) = CDF\left(\frac{(\hat{SR} - SR^{\ast})\sqrt{n-1}}{\sqrt{1 - \hat{\gamma}_{3}\hat{SR} + \frac{\hat{\gamma}_{4}-1}{4}\hat{SR}^{2}}}\right) \]

where $SR^{\ast}$ is the Sharpe ratio of the benchmark, $\hat{SR}$ is the Sharpe ratio of the algorithm, $n$ is the number of trading days, $\hat{\gamma}_{3}$ is the skewness of the algorithm's returns, $\hat{\gamma}_{4}$ is the kurtosis of the algorithm's returns, and $CDF$ is the normal cumulative distribution function. For more information about the PSR, see Bailey and López de Prado (2012).

profit loss ratio

The ratio of the average win rate to the average loss rate.

It is calculated as

$$ PLR = \frac{\bar{W}}{|\bar{L}|} $$

where $\bar{W}$ is the average win and $\bar{L}$ is the average loss. A profit-loss ratio greater than 1 indicates that the average winning trade is larger than the average losing trade.

put call parity

A relationship between the prices of a European call Option, a European put Option, the underlying asset, and the risk-free rate.

It is defined as

$$ C(t,K) - P(t,K) = e^{(q-r)t}(S_T - K) $$

where $C$ is the call price, $P$ is the put price, $K$ is the strike price, $S_T$ is the underlying asset price, $r$ is the risk-free rate, $q$ is the dividend yield, and $t$ is the time to expiration.

return

The rate of return across the entire trading period.

It is calculated as

$$ R = \frac{e - s}{s} $$

where $s$ is starting equity and $e$ is ending equity.

risk free interest rate

The interest rate an investor can expect to earn on an investment that carries zero risk, such as the interest paid on a 10-year highly rated government treasury note. The risk-free rate serves as a baseline for evaluating the performance of risky investments.

Sharpe ratio

A measure of the risk-adjusted return, developed by William Sharpe.

It is calculated as

$$ SR = \frac{E[R_p - R_b]}{\sigma_p} $$

where $R_p$ is the return of the portfolio, $R_b$ is the return of the benchmark, and $\sigma_p$ is the standard deviation of the portfolio's excess returns. By default, LEAN uses a 0% risk-free rate, so $R_b = 0$. For more information about the Sharpe ratio, see Sharpe (1994).

Sortino ratio

A measure of the risk-adjusted return, developed by Frank Sortino. Unlike the Sharpe ratio, the Sortino ratio only penalizes returns falling below a user-specified target or required rate of return.

It is calculated as

$$ S = \frac{R_p - R_f}{\sigma_d} $$

where $R_p$ is the portfolio return, $R_f$ is the risk-free rate, and $\sigma_d$ is the downside deviation (the standard deviation of negative returns only). By using downside deviation, the Sortino ratio does not penalize upside volatility.

tail value at risk

The expected loss of a portfolio beyond the Value at Risk threshold, also known as Conditional Value at Risk (CVaR).

Assuming normally distributed returns, it is calculated as

$$ \text{TVaR}_{\alpha} = \mu + \sigma \times \frac{\phi[\Phi^{-1}(\alpha)]}{1 - \alpha} $$

where $\mu$ is the mean return, $\sigma$ is the standard deviation, $\alpha$ is the confidence level, $\phi$ is the standard normal density function, and $\Phi^{-1}$ is the inverse of the standard normal cumulative distribution function.

total fees

The total quantity of fees paid for all the transactions during the algorithm's trading period. Total fees include brokerage commissions, exchange fees, and other transaction costs.

total net profit

The rate of return across the entire trading period.

It is calculated as

$$ \text{Total Net Profit} = \frac{e - s}{s} $$

where $s$ is starting equity and $e$ is ending equity.

total trades

The number of orders that were filled or partially filled during the algorithm's trading period.

tracking error

A measure of how closely a portfolio follows the index to which it is benchmarked.

It is calculated as

$$ TE = \sigma(R_p - R_b) $$

where $R_p$ is the portfolio return, $R_b$ is the benchmark return, and $\sigma$ denotes the standard deviation. A tracking error of 0 indicates a perfect match with the benchmark.

Treynor ratio

A measurement of the returns earned in excess of the risk-free rate per unit of benchmark risk, developed by Jack Treynor.

It is calculated as

$$ T = \frac{R_p - R_f}{\beta} $$

where $R_p$ is the portfolio return, $R_f$ is the risk-free rate, and $\beta$ is the portfolio's beta. Unlike the Sharpe ratio, which uses total risk (standard deviation), the Treynor ratio uses systematic risk (beta).

unrealized

The amount of profit a portfolio would capture if it liquidated all open positions and paid the fees for transacting and crossing the spread. Unrealized profit becomes realized profit when the positions are closed.

volume

The total value of assets traded for all of an algorithm's transactions during the trading period.

win rate

The proportion of trades that were profitable after transaction fees.

It is calculated as

$$ W_r = \frac{n_W}{N} $$

where $n_W$ is the number of profitable trades and $N$ is the total number of trades.

z score

The number of standard deviations a data point is from the mean of a dataset.

It is calculated as

$$ Z = \frac{x - \mu}{\sigma} $$

where $x$ is the data point, $\mu$ is the mean, and $\sigma$ is the standard deviation. A z-score of 0 indicates the data point equals the mean. Values beyond $\pm 3$ are commonly considered outliers.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: