Lesson 04: The Real Role of Technical Indicators
Core insight: Indicators are not "buy/sell signals" - they are feature engineering.
The Illusion of "Golden Cross Means Rally"
Xiao Li is a stock market newbie. He learned a "guaranteed win" rule online: Buy on MACD golden cross, sell on death cross.
He excitedly wrote a program and backtested 10 years of data. Result: 52% win rate, -8% annualized return.
"How is this possible? The golden cross is clearly a bullish signal!"
He tried RSI oversold buying, Bollinger Band lower band buying, moving average bullish alignment buying... Every "classic signal," when used alone, had win rates hovering around 50%, all losing money after fees.
What went wrong?
Xiao Li made a common mistake: treating technical indicators as buy/sell signals.
The truth is:
- Indicators are lagging: By the time of a MACD golden cross, the price has already risen
- Indicators are simplified: A single number cannot capture complex market states
- Indicators are exploited: When everyone watches the same signal, the signal becomes ineffective
So what are technical indicators actually useful for?
The answer: Feature engineering. Indicators aren't meant for direct trading; they're for describing market states. When you combine dozens of indicators - MACD, RSI, Bollinger Bands, etc. - as input features for machine learning models, they can truly deliver value.
This lesson's goal: Help you understand the essence of technical indicators and learn to use them correctly.
4.1 The Essence of Indicators
Indicators = Mathematical Transformations
All technical indicators are essentially mathematical transformations of price and volume:
| Raw Data | Transformation Method | Resulting Indicator |
|---|---|---|
| Close price series | Moving average | MA (Moving Average) |
| Close price series | Exponentially weighted average | EMA (Exponential Moving Average) |
| Price change series | Relative strength calculation | RSI |
| Price series | Mean +/- standard deviation | Bollinger Bands |
| High, Low, Close prices | Multiple calculations | MACD |
Core insight: Indicators don't create new information; they just present existing information differently.
Lag is an Inherent Property
Any indicator calculated from historical data is inherently lagging:
Price has already changed
|
Calculate indicator
|
Indicator generates signal
|
You take action
|
Price may have already reversed
| Indicator | Typical Parameters | Lag Amount |
|---|---|---|
| MA5 | 5-day average | About 2-3 days |
| MA20 | 20-day average | About 10 days |
| MACD | 12, 26, 9 | About 5-10 days |
| RSI(14) | 14-day | About 7 days |
Takeaway: Don't expect indicators to "predict" the future; they can only describe "now" and "the past."
Information Compression and Loss
Compressing hundreds of days of price data into a single number (like RSI=65) inevitably loses significant information:
- Distribution shape of prices? Lost
- Volume change patterns? Lost
- Intraday volatility characteristics? Lost
This is why a single indicator cannot effectively guide trading - there's too little information.
4.2 Trend Indicators
MA / EMA: The Smoothing vs Lag Trade-off
Moving Average (MA): Simple average of the past N days' closing prices.
MA(5) = (P1 + P2 + P3 + P4 + P5) / 5
Exponential Moving Average (EMA): Gives higher weight to recent prices.
EMA = Today's price x alpha + Yesterday's EMA x (1-alpha)
where alpha = 2 / (N+1)
| Comparison | MA (Simple Moving Average) | EMA (Exponential Moving Average) |
|---|---|---|
| Weight distribution | Equal | Higher for recent data |
| Response to new data | Slow | Fast |
| Smoothness | Smoother | More sensitive |
| Use case | Long-term trends | Short-term trends |
Core trade-off: Smaller parameters -> More sensitive -> More noise; Larger parameters -> More stable -> More lag.
MACD: Trend and Momentum
MACD is one of the most commonly used trend indicators, consisting of three parts:
DIFF (Fast line) = EMA12 - EMA26
DEA (Signal line) = EMA9(DIFF)
Histogram = 2 x (DIFF - DEA)
Platform note: Some trading platforms (especially in Asian markets like TradingView China, Tonghuashun) multiply the histogram by 2, while Western platforms typically don't. When referencing MACD values, always confirm the formula your platform uses.
Intuitive understanding:
- DIFF: Gap between short-term and long-term trend
- DEA: Smoothed version of DIFF
- Histogram: Degree of trend acceleration/deceleration
| MACD State | Meaning | Market Interpretation |
|---|---|---|
| DIFF > 0, Histogram expanding | Uptrend accelerating | Bulls strong |
| DIFF > 0, Histogram shrinking | Uptrend decelerating | Possible top |
| DIFF < 0, Histogram shrinking | Downtrend decelerating | Possible bottom |
| DIFF < 0, Histogram expanding | Downtrend accelerating | Bears strong |
Divergence Analysis
Divergence is one of the most important concepts in technical analysis:
| Divergence Type | Price Behavior | MACD Behavior | Meaning |
|---|---|---|---|
| Bearish Divergence | New high | No new high | Upward momentum exhausted, may fall |
| Bullish Divergence | New low | No new low | Downward momentum exhausted, may rise |
Bearish divergence example:
Price: 100 -> 110 -> 120 -> 125 -> 130 (new high)
MACD: 10 -> 15 -> 18 -> 16 -> 14 (no new high)
^
Momentum exhaustion signal
Important warning:
- Divergence is only a "possible" signal, not a "certain" signal
- Trading on divergence alone typically has only 55-60% win rate
- Needs confirmation from other indicators and market structure
4.3 Oscillator Indicators
RSI: Relative Strength
RSI measures the relative strength of recent ups and downs:
RS = Average gain / Average loss
RSI = 100 - 100/(1+RS)
RSI ranges from 0-100:
| RSI Range | Traditional Interpretation | Reality |
|---|---|---|
| > 70 | Overbought, should sell | Strong markets can stay > 80 |
| 30-70 | Normal range | Most of the time here |
| < 30 | Oversold, should buy | Weak markets can stay < 20 |
Real usage of RSI:
- Don't rely solely on 70/30 as buy/sell signals
- RSI trend matters more: RSI rising from 30 vs RSI oscillating at 60-70
- RSI divergence is equally valid: Price makes new high but RSI doesn't = bearish divergence
Bollinger Bands
Bollinger Bands consist of three lines:
Middle band = MA20 (20-day moving average)
Upper band = MA20 + 2 sigma (mean + 2 standard deviations)
Lower band = MA20 - 2 sigma (mean - 2 standard deviations)
Statistical meaning: Under normal distribution assumption, price has 95% probability of being between upper and lower bands.
| Bollinger Signal | Traditional Interpretation | Applicable Scenario |
|---|---|---|
| Touch upper band | Overbought, may pull back | Sideways market |
| Touch lower band | Oversold, may bounce | Sideways market |
| Break upper band | Trend starting | Trending market |
| Band narrowing | Volatility decreasing, breakout coming | All markets |
Key insight: Bollinger Bands are "reversion" signals in sideways markets, "breakout" signals in trending markets - you need to first identify the market state.
4.4 Volatility Indicators
Historical Volatility
Historical Volatility = Standard deviation of past N days' returns x sqrt(252) (annualized)
Example calculation:
Daily return standard deviation = 2%
Annualized volatility = 2% x sqrt(252) ~ 31.7%
| Annualized Volatility | Typical Assets | Risk Level |
|---|---|---|
| 10-15% | Bonds, large-cap blue chips | Low |
| 20-30% | Regular stocks | Medium |
| 40-60% | Small caps, cryptocurrencies | High |
| 80%+ | Altcoins, expiring options | Extreme |
ATR (Average True Range)
ATR measures "true volatility range," accounting for gaps:
True Range = max(
Today's High - Today's Low,
|Today's High - Yesterday's Close|,
|Today's Low - Yesterday's Close|
)
ATR = N-day average of True Range
Practical uses of ATR:
- Stop-loss setting: Stop distance = Entry price +/- 2 x ATR
- Position sizing: Reduce position when volatility is high, can increase when low
- Breakout confirmation: Breakout > 1 x ATR more likely to be genuine
4.5 Strategy Evaluation Metrics
These metrics evaluate strategy performance, not trading signals:
Sharpe Ratio
Sharpe Ratio = (Rp - Rf) / sigma_p
Rp = Portfolio return
Rf = Risk-free rate (e.g., Treasury yield)
sigma_p = Standard deviation of returns
Intuitive understanding: How much excess return per unit of risk taken.
| Sharpe Ratio | Evaluation |
|---|---|
| < 0 | Losing money, worse than bank deposit |
| 0-1 | Average, may not be worth the risk |
| 1-2 | Good |
| 2-3 | Excellent |
| > 3 | Top-tier (or data issues) |
Other Risk Metrics
| Metric | Formula | Meaning |
|---|---|---|
| Sortino Ratio | (Rp - Rf) / sigma_downside | Only penalizes downside volatility, focuses on loss risk |
| Maximum Drawdown | Largest peak-to-trough decline | Worst-case loss |
| Calmar Ratio | Annualized return / Max drawdown | Balance of return and drawdown |
| VaR (95%) | Maximum loss at 95% confidence | Risk boundary under normal conditions |
Example:
- Strategy with 20% annual return, 40% max drawdown -> Calmar = 0.5 (average)
- Strategy with 15% annual return, 10% max drawdown -> Calmar = 1.5 (excellent)
4.6 Indicator Combinations: From Signals to Features
Why Single Indicators Don't Work
Empirical research shows single technical indicators have very limited predictive power:
| Strategy | Win Rate | Annualized Return (after fees) |
|---|---|---|
| MACD Golden/Death Cross | 51% | -5% to +3% |
| RSI Overbought/Oversold | 52% | -3% to +5% |
| Bollinger Band Breakout | 50% | -8% to +2% |
| Dual Moving Average Cross | 53% | -2% to +8% |
Note: These figures are illustrative/reference values. Actual performance varies significantly by market, timeframe, parameter settings, and cost assumptions (commissions, slippage, bid-ask spread). Always validate with your own backtests.
Reasons:
- All market participants watch the same signal -> Signal gets priced in early
- Different market states need different interpretations -> Single rule can't adapt
- Indicator information is incomplete -> Needs multi-dimensional verification
Correct Usage of Indicators as Features
Traditional usage (wrong):
RSI < 30 -> Buy
Correct usage (feature engineering):
Feature vector = [
RSI,
RSI rate of change,
MACD_DIFF,
MACD_Histogram rate of change,
Bollinger Band position (price's relative position within bands),
ATR (volatility),
Volume rate of change,
...more features
]
-> Input to ML model -> Output: Buy/Sell/Hold + Confidence
Multi-Agent Perspective:
- Trend Agent: Focuses on MACD, moving averages, ATR
- Mean Reversion Agent: Focuses on RSI, Bollinger Bands, deviation
- Regime Agent: Focuses on volatility changes, correlation changes
- Risk Agent: Focuses on VaR, max drawdown, Sharpe changes
Code Implementation (Optional)
If you want hands-on practice, here's sample code for calculating indicators:
import pandas as pd
import numpy as np
def calculate_indicators(df):
"""
Calculate common technical indicators
df needs columns: open, high, low, close, volume
"""
# EMA
df['EMA12'] = df['close'].ewm(span=12).mean()
df['EMA26'] = df['close'].ewm(span=26).mean()
# MACD
df['MACD_DIFF'] = df['EMA12'] - df['EMA26']
df['MACD_DEA'] = df['MACD_DIFF'].ewm(span=9).mean()
df['MACD_Histogram'] = 2 * (df['MACD_DIFF'] - df['MACD_DEA'])
# RSI
delta = df['close'].diff()
gain = delta.where(delta > 0, 0).rolling(14).mean()
loss = (-delta.where(delta < 0, 0)).rolling(14).mean()
# Avoid division by zero: when loss=0 (continuous up moves), RSI=100
rs = gain / loss.replace(0, np.nan)
df['RSI'] = (100 - 100 / (1 + rs)).fillna(100)
# Bollinger Bands
df['BB_Middle'] = df['close'].rolling(20).mean()
df['BB_Std'] = df['close'].rolling(20).std()
df['BB_Upper'] = df['BB_Middle'] + 2 * df['BB_Std']
df['BB_Lower'] = df['BB_Middle'] - 2 * df['BB_Std']
df['BB_Position'] = (df['close'] - df['BB_Lower']) / (df['BB_Upper'] - df['BB_Lower'])
# ATR
high_low = df['high'] - df['low']
high_close = (df['high'] - df['close'].shift()).abs()
low_close = (df['low'] - df['close'].shift()).abs()
tr = pd.concat([high_low, high_close, low_close], axis=1).max(axis=1)
df['ATR'] = tr.rolling(14).mean()
return df
def calculate_sharpe_ratio(returns, risk_free_rate=0.04, periods_per_year=252):
"""Calculate Sharpe Ratio"""
excess_returns = returns - risk_free_rate / periods_per_year
return np.sqrt(periods_per_year) * excess_returns.mean() / returns.std()
Lesson Deliverables
After completing this lesson, you will have:
- Correct understanding of technical indicators - Know that indicators are "features" not "signals"
- Calculation methods for common indicators - Understand the essence of MACD, RSI, Bollinger Bands, ATR
- Strategy evaluation ability - Can use Sharpe, Sortino, Calmar and other metrics to evaluate strategies
- Multi-dimensional thinking framework - Know which indicators suit different market states and Agents
Key Takeaways
- Understand the essence of technical indicators: Mathematical transformations of price/volume, no new information created
- Master usage of trend indicators (MACD) and oscillator indicators (RSI, Bollinger Bands)
- Understand the principles and limitations of divergence analysis
- Learn to use Sharpe Ratio and other metrics to evaluate strategy performance
- Recognize limitations of single indicators; understand the value of indicator combinations as features
Extended Reading
- Background: Alpha and Beta - Strategy return decomposition
- Background: Famous Quant Disasters - The cost of over-relying on indicators
Next Lesson Preview
Lesson 05: Classic Strategy Paradigms
Trend following, mean reversion, grid trading, pairs trading... What are the characteristics of these classic strategies? What markets are they suitable for? What are their pitfalls? Next lesson we break them down one by one.