Lesson 2: Technical Indicators — Moving Averages, RSI & MACD
Learn the most widely-used technical indicators to identify trends, momentum, and overbought/oversold conditions.
What Are Technical Indicators?
Technical indicators are mathematical calculations based on price, volume, or open interest. They help traders identify trends, momentum, volatility, and potential reversal points.
Mental model: Indicators are like dashboard gauges in a car — they don't tell you where to drive, but they tell you how fast you're going, how much fuel you have, and whether the engine is overheating.
Types of Indicators
| Category | Purpose | Examples |
|---|---|---|
| Trend | Identify direction | Moving Averages, ADX |
| Momentum | Measure speed of change | RSI, MACD, Stochastic |
| Volatility | Measure price fluctuation | Bollinger Bands, ATR |
| Volume | Confirm trends with volume | OBV, Volume Profile |
Moving Averages — The Foundation
A Moving Average (MA) smooths out price data by creating a constantly updated average price over a specific period.
Types of Moving Averages
| Type | Calculation | Characteristics |
|---|---|---|
| SMA (Simple) | Equal weight to all periods | Smooth, slower to react |
| EMA (Exponential) | More weight to recent prices | Responsive, faster signals |
Common Moving Average Periods
| Period | Name | Use Case |
|---|---|---|
| 9/10 EMA | Short-term | Scalping, day trading |
| 20 EMA | Short-term | Swing trading, dynamic support |
| 50 SMA | Medium-term | Trend confirmation |
| 100 SMA | Medium-term | Major trend direction |
| 200 SMA | Long-term | Bull/bear market filter |
Moving Average Crossover Strategy
| Signal | Description | Action |
|---|---|---|
| Golden Cross | 50 MA crosses above 200 MA | Bullish — consider buying |
| Death Cross | 50 MA crosses below 200 MA | Bearish — consider selling |
Key insight: Moving averages are lagging indicators — they confirm trends but don't predict them. Use them with other tools, not in isolation.
RSI (Relative Strength Index)
RSI measures the speed and magnitude of recent price changes to identify overbought or oversold conditions.
RSI Formula Concept
RSI = 100 - (100 / (1 + RS))
Where RS = Average Gain / Average Loss over the period (typically 14 days)
RSI Interpretation
| RSI Value | Condition | Potential Action |
|---|---|---|
| Above 70 | Overbought | Consider selling or waiting for pullback |
| 50-70 | Bullish momentum | Hold or look for buy opportunities |
| 30-50 | Bearish momentum | Be cautious, wait for confirmation |
| Below 30 | Oversold | Consider buying or watching for reversal |
RSI Divergence (Advanced Signal)
| Divergence Type | Price Action | RSI Action | Signal |
|---|---|---|---|
| Bullish Divergence | Price makes lower low | RSI makes higher low | Potential reversal up |
| Bearish Divergence | Price makes higher high | RSI makes lower high | Potential reversal down |
MACD (Moving Average Convergence Divergence)
MACD shows the relationship between two moving averages of a stock's price.
MACD Components
| Component | Description | Typical Settings |
|---|---|---|
| MACD Line | 12 EMA - 26 EMA | Fast line |
| Signal Line | 9 EMA of MACD Line | Slow line |
| Histogram | MACD Line - Signal Line | Shows momentum |
MACD Signals
| Signal | Description | Meaning |
|---|---|---|
| Bullish Crossover | MACD crosses above Signal | Buy signal |
| Bearish Crossover | MACD crosses below Signal | Sell signal |
| Zero Line Cross | MACD crosses above/below 0 | Trend change |
| Histogram Growing | Bars getting larger | Momentum increasing |
| Histogram Shrinking | Bars getting smaller | Momentum fading |
Combining Indicators — The Power of Confluence
The best trading signals come when multiple indicators agree:
| Confluence Setup | Indicators | Signal Strength |
|---|---|---|
| Trend + Momentum | 50 MA up + RSI > 50 | Strong buy |
| Support + Oversold | Price at support + RSI < 30 | High-probability buy |
| Resistance + Overbought | Price at resistance + RSI > 70 | High-probability sell |
| Crossover + Volume | MA crossover + high volume | Confirmed signal |
Mental model: Think of confluence as a jury — one indicator alone might be wrong, but when multiple indicators agree, the verdict is much more reliable.
Common Mistakes to Avoid
- Mistake: Using too many indicators — Fix: Stick to 2-3 that complement each other.
- Mistake: Using lagging indicators for prediction — Fix: Use them for confirmation, not prediction.
- Mistake: Ignoring the trend — Fix: Always know the bigger picture before trading indicators.
- Mistake: Over-optimizing indicator settings — Fix: Default settings work well for most situations.
Professional Tips & Tricks
- RSI works best in ranging markets; MACD works best in trending markets.
- Moving averages are dynamic support/resistance — watch for bounces.
- Divergences are early warning signals but require patience to play out.
- Always check the daily chart before trading on shorter timeframes.
Key Takeaways
- Moving averages smooth price data and identify trend direction.
- RSI measures momentum and identifies overbought/oversold conditions.
- MACD shows trend changes through line crossovers and histogram analysis.
- Combine multiple indicators for stronger signals (confluence).
- No single indicator is perfect — use them as part of a complete system.
Next up: Volume analysis and trade entry/exit strategies.
# Technical Indicators Cheat Sheet
## Moving Average Settings
SMA (Simple Moving Average):
- Short-term: 10, 20 periods
- Medium-term: 50, 100 periods
- Long-term: 200 periods
EMA (Exponential Moving Average):
- Short-term: 9, 12 periods
- Medium-term: 26 periods
- Signal line: 9 period EMA of MACD
## RSI Calculation (14-period)
RSI = 100 - (100 / (1 + RS))
RS = Avg Gain / Avg Loss
Interpretation:
- RSI > 70 → Overbought (sell zone)
- RSI < 30 → Oversold (buy zone)
- RSI = 50 → Neutral
## MACD Formula
MACD Line = 12 EMA - 26 EMA
Signal Line = 9 EMA of MACD Line
Histogram = MACD Line - Signal Line
Signals:
- MACD crosses above Signal → BUY
- MACD crosses below Signal → SELL
- MACD crosses above 0 → Bullish trend
- MACD crosses below 0 → Bearish trend
## Indicator Combo Guide
| Trend + Momentum | Signal |
|------------------|--------|
| 50 MA up + RSI > 50 | Strong Buy |
| 50 MA down + RSI < 50 | Strong Sell |
| Price at Support + RSI < 30 | Buy |
| Price at Resistance + RSI > 70 | Sell |Lesson Code (Python)
# Technical Indicators Cheat Sheet
## Moving Average Settings
SMA (Simple Moving Average):
- Short-term: 10, 20 periods
- Medium-term: 50, 100 periods
- Long-term: 200 periods
EMA (Exponential Moving Average):
- Short-term: 9, 12 periods
- Medium-term: 26 periods
- Signal line: 9 period EMA of MACD
## RSI Calculation (14-period)
RSI = 100 - (100 / (1 + RS))
RS = Avg Gain / Avg Loss
Interpretation:
- RSI > 70 → Overbought (sell zone)
- RSI < 30 → Oversold (buy zone)
- RSI = 50 → Neutral
## MACD Formula
MACD Line = 12 EMA - 26 EMA
Signal Line = 9 EMA of MACD Line
Histogram = MACD Line - Signal Line
Signals:
- MACD crosses above Signal → BUY
- MACD crosses below Signal → SELL
- MACD crosses above 0 → Bullish trend
- MACD crosses below 0 → Bearish trend
## Indicator Combo Guide
| Trend + Momentum | Signal |
|------------------|--------|
| 50 MA up + RSI > 50 | Strong Buy |
| 50 MA down + RSI < 50 | Strong Sell |
| Price at Support + RSI < 30 | Buy |
| Price at Resistance + RSI > 70 | Sell |Console Output
Technical Indicators Cheat Sheet
## Moving Average Settings
SMA (Simple Moving Average):
- Short-term: 10, 20 periods
- Medium-term: 50, 100 periods
- Long-term: 200 periods
EMA (Exponential Moving Average):
- Short-term: 9, 12 periods
- Medium-term: 26 periods
- Signal line: 9 period EMA of MACD
## RSI Calculation (14-period)
RSI = 100 - (100 / (1 + RS))
RS = Avg Gain / Avg Loss
Interpretation:
- RSI > 70 → Overbought (sell zone)
- RSI < 30 → Oversold (buy zone)
- RSI = 50 → Neutral
## MACD Formula
MACD Line = 12 EMA - 26 EMA
Signal Line = 9 EMA of MACD Line
Histogram = MACD Line - Signal Line
Signals:
- MACD crosses above Signal → BUY
- MACD crosses below Signal → SELL
- MACD crosses above 0 → Bullish trend
- MACD crosses below 0 → Bearish trend
## Indicator Combo Guide
| Trend + Momentum | Signal |
|------------------|--------|
| 50 MA up + RSI > 50 | Strong Buy |
| 50 MA down + RSI < 50 | Strong Sell |
| Price at Support + RSI < 30 | Buy |
| Price at Resistance + RSI > 70 | Sell |Code Visualization Tips
- Overlay a 50-day and 200-day moving average on a stock chart and watch for crossovers.
- Mark overbought (>70) and oversold (<30) zones on the RSI indicator.
- Watch the MACD histogram grow and shrink to feel momentum changes.
Professional Tips & Tricks
- RSI works best in ranging markets; MACD works best in trending markets.
- Use the 200-day MA as a bull/bear filter — only buy above it, only sell below it.
- Divergences take time to play out — be patient and wait for confirmation.
Python Code Judge & Practice Arena
LeetCode StyleRun real Python 3.12 WebAssembly code directly in your browser against automated test suites.
Moving Average Analysis
Up next · Continue learning
Volume Analysis & Trade Execution
Use volume to confirm trends, identify accumulation/distribution, and execute trades with proper entry and exit strategies.