Glossary ======== A plain-English reference for trading and backtesting terms used throughout Quantlens. .. tip:: Click any term in the left sidebar to jump directly to it. ---- .. glossary:: :sorted: Annualised Return The total return of a strategy scaled to a 12-month period. If a strategy returned 8% over 6 months, the annualised return is approximately 16%. Useful for comparing strategies that ran for different lengths of time. ATR (Average True Range) A measure of how much an asset typically moves per day — its *volatility*. A higher ATR means larger day-to-day price swings. Commonly used to set stop-loss distances: e.g. place the stop 2 × ATR below the entry price. See :ref:`atr`. Backtesting Simulating a trading strategy on historical price data to see how it would have performed. The core function of Quantlens. Results are an *estimate* — not a guarantee of future returns. Bearish Expecting or experiencing a decline in price. A "bearish signal" suggests selling or avoiding a position. Bollinger Bands Three lines plotted around a moving average: an upper band, a middle band (SMA), and a lower band. The width of the bands reflects current volatility. Price touching the lower band can signal oversold conditions; touching the upper band can signal overbought. See :ref:`bbands`. Bullish Expecting or experiencing a rise in price. A "bullish signal" suggests buying or holding a position. Buy and Hold The simplest investment strategy: buy an asset and hold it indefinitely. Used as a benchmark — if your strategy can't beat buy-and-hold, it may not be worth the complexity. Calmar Ratio Annualised Return divided by Maximum Drawdown (absolute value). Higher is better. Measures how much return you get per unit of drawdown risk. Commission The fee charged by a broker for executing a trade. In Quantlens, set as a percentage per trade (e.g. ``0.1%`` = 0.1% of trade value). Over many trades, commissions can significantly reduce total return. Compound Annual Growth Rate (CAGR) The rate at which an investment would have grown each year if it grew at a steady rate. ``CAGR = (Final Value / Initial Value) ^ (1 / Years) − 1`` Cooldown Period A minimum number of days that must pass before a stock that was stopped out can be re-entered. Prevents buying back into a recently damaged position. See :ref:`stock_cooldown_filter`. Curve Fitting Also called *overfitting*. When a strategy's parameters are tuned too precisely to historical data, the strategy looks excellent in backtesting but fails in live trading. The key symptom: great in-sample Sharpe but poor out-of-sample Sharpe. Drawdown A peak-to-trough decline in portfolio value. If your portfolio peaks at $120,000 and falls to $90,000 before recovering, that is a drawdown of -25%. Equity Curve A chart showing the growth (or decline) of the portfolio's value over time. A smooth, upward-sloping equity curve is a sign of a consistent strategy. Violent ups and downs suggest high risk or data snooping. EMA (Exponential Moving Average) A moving average that weights recent prices more heavily than older ones. Reacts faster to new price information than SMA. See :ref:`ema`. Entry Signal The condition that triggers buying a new position. Example: "RSI crosses below 30" or "50-day SMA crosses above 200-day SMA". Exit Signal The condition that triggers closing an existing position. Can be a profit target, stop-loss, or a reversal of the entry condition. Gross Profit / Gross Loss **Gross Profit** is the total profit from all winning trades before subtracting losses. **Gross Loss** is the total loss from all losing trades. Used in the :term:`Profit Factor` calculation. In-Sample Period The historical date range used to *develop* and *optimise* a strategy. Results on this period are optimistic — the strategy was built to fit it. Always test on a separate :term:`Out-of-Sample Period`. Indicator A mathematical calculation applied to price or volume data to signal potential trade opportunities. Examples: RSI, MACD, Bollinger Bands, ATR. See :doc:`blocks_indicators`. Limit Order An order to buy only if the price drops to a specified level. In Quantlens, the :ref:`enter_next_week_limit` block places limit orders at a discount to the current close. Lookback Period The number of historical bars (candles) used to calculate an indicator. RSI(14) uses the last 14 bars. SMA(200) uses the last 200 bars. MACD (Moving Average Convergence Divergence) An indicator that compares a fast and slow EMA to show momentum direction. A bullish signal occurs when the MACD line crosses above the Signal line. See :ref:`macd`. Market Order An order to buy or sell immediately at the current market price. In Quantlens, most rebalance blocks execute as market orders at end-of-day (``eod``) or start-of-day (``sod``). Max Drawdown The largest peak-to-trough decline in the entire backtest period. The single most important risk metric for evaluating a strategy. A Max Drawdown of -40% means at some point the portfolio lost 40% of its peak value. Mean Reversion A strategy style based on the idea that extreme price moves tend to reverse. Example: buy when RSI < 30 (oversold), sell when RSI > 70 (overbought). Momentum A strategy style based on the tendency of assets that have recently performed well to continue outperforming. Example: buy the top 10 stocks ranked by 6-month return; rebalance monthly. See :ref:`momentum`. Moving Average The average price over a rolling window of N bars. Smooths out noise to show the underlying trend direction. Types in Quantlens: :ref:`sma`, :ref:`ema`, :ref:`wma`, :ref:`dema`, :ref:`tema`, :ref:`vwma`. Offset A parameter available on every indicator block. ``Offset = 0`` returns today's value. ``Offset = 1`` returns yesterday's value. Use offsets to compare today's indicator value with a previous period. Out-of-Sample Period A date range *not* used to build the strategy. Testing on out-of-sample data is the best way to check whether a strategy is genuinely robust or just overfit to historical patterns. Overbought When an indicator signals that an asset has risen too far, too fast. RSI > 70 is the classic overbought signal. Overbought does *not* always mean the price will reverse — in strong trends it can stay overbought for months. Oversold When an indicator signals that an asset has fallen too far, too fast. RSI < 30 is the classic oversold signal. Overfitting See :term:`Curve Fitting`. Position Sizing How much of the portfolio is allocated to each trade. Quantlens divides the portfolio equally across all open :term:`Slots`. Example: 10 slots = 10% of portfolio per position. Profit Factor Total gross profit divided by total gross loss. ``Profit Factor = Gross Profit / Gross Loss`` .. list-table:: :header-rows: 1 :widths: 30 70 * - Value - Interpretation * - < 1.0 - Strategy loses more than it gains — unprofitable. * - 1.0 – 1.5 - Marginal. Sensitive to costs and slippage. * - > 1.5 - Healthy. Good balance of wins and losses. * - > 2.0 - Strong. Check for overfitting. Rebalancing Periodically reviewing and adjusting the portfolio — selling positions that no longer qualify and buying new ones that do. Quantlens rebalances at fixed intervals set in the :ref:`config` block. RSI (Relative Strength Index) A momentum oscillator ranging from 0 to 100. Values below 30 signal oversold; above 70 signal overbought. See :ref:`rsi`. Sharpe Ratio The most widely used risk-adjusted performance metric. ``Sharpe = (Portfolio Return − Risk-Free Rate) / Portfolio Volatility`` A higher Sharpe means more return per unit of risk. .. list-table:: :header-rows: 1 :widths: 25 75 * - Sharpe - Meaning * - < 0 - Losing money on a risk-adjusted basis. * - 0 – 1 - Positive but weak. * - 1 – 2 - Good. * - > 2 - Excellent. Double-check for overfitting. Slippage The difference between the expected price of a trade and the actual fill price. In real markets, large orders move the price slightly against you. In Quantlens, set a slippage % in the backtest settings to simulate this effect. Slots The maximum number of positions the portfolio can hold simultaneously. Set in the :ref:`config` block. Determines position sizing (``1 / slots`` per position). SMA (Simple Moving Average) The plain arithmetic average of closing prices over the last N bars. See :ref:`sma`. Sortino Ratio Like :term:`Sharpe Ratio` but only penalises *downside* volatility (losses). A better metric for strategies with asymmetric returns. Higher is better. Stop-Loss A pre-set price level at which a position is automatically closed to limit losses. Set as a percentage in the :ref:`config` block (e.g. ``0.05`` = close if the position falls 5%). Survivorship Bias Historical stock universe data typically only includes companies that *survived* (didn't go bankrupt). This makes backtests appear better than they would have been in reality, because you never accidentally bought stocks that later went to zero. Take-Profit A pre-set price level at which a profitable position is automatically closed to lock in gains. Set as a percentage in the :ref:`config` block. Total Return The percentage gain or loss over the entire backtest period. Does not account for how long the backtest ran — use :term:`Annualised Return` for fair comparisons. Trend Following A strategy style that buys assets in uptrends and holds until the trend reverses. Based on the observation that "trends persist" — momentum in financial markets. Universe The set of stocks the strategy considers for investment. In Quantlens, the universe is the NASDAQ composite (all liquid NASDAQ-listed stocks). Volatility How much the price of an asset fluctuates. High volatility = large, unpredictable price swings. Low volatility = steady, gradual price movement. Measured quantitatively by :ref:`atr`, :ref:`stddev`, or :ref:`natr`. Win Rate The percentage of trades that were profitable. ``Win Rate = Profitable Trades / Total Trades × 100`` .. note:: A high win rate does not mean a profitable strategy. A strategy can win 70% of the time but still lose money overall if the average loss is much larger than the average win. Walk-Forward Optimisation A robust testing method that repeatedly optimises on one period, then tests on the next. Produces a series of out-of-sample results instead of a single in-sample number. Much more reliable than single-period optimisation. Available on Silver and Gold plans.