The Simple Moving Average is the arithmetic mean of price over N periods. It is the oldest, most widely used indicator in technical analysis — and the foundation every more complex trend indicator is built on.
Section 1: Core Mechanics
The SMA answers one question: what is the average closing price over the last N bars?
Formula
Where is the closing price of bar , and is the period.
Each new bar drops the oldest price and adds the newest — a rolling window across the price series.
Inputs
- Price source: Close price (default). Can apply to Open, High, Low, or HL/2.
- Period (N): Number of bars in the average. Standard values: 9, 20, 50, 100, 200.
Parameters
| Parameter | Default | Typical Range | Impact |
|---|---|---|---|
| Period (N) | 20 | 5–200 | Lower = more responsive, more noise. Higher = smoother, more lag. |
| Price source | Close | Close / HL2 / HLC3 | Minimal difference in practice — Close is standard |
Output
SMA outputs a single value per bar on the same price scale as the chart. It plots as a smooth curved line overlaid on candlesticks.
Visual Behavior
- Price above SMA → uptrend bias
- Price below SMA → downtrend bias
- Two SMAs on chart → crossover system (fast crosses slow = signal)
- SMA slope rising → trend accelerating; flat → trend stalling; falling → downtrend
Section 2: Interpretation & Signals
Signal Zones
| Condition | Interpretation |
|---|---|
| Price > SMA(200) | Long-term uptrend — institutional bull bias |
| Price < SMA(200) | Long-term downtrend — institutional bear bias |
| SMA(50) > SMA(200) | Golden Cross — medium-term momentum bullish |
| SMA(50) < SMA(200) | Death Cross — medium-term momentum bearish |
| Price bounces off SMA | SMA acting as dynamic support/resistance |
Crossover Signals
The two-SMA crossover is the most common signal system:
SMA Golden Cross — SMA(50) crosses above SMA(200)
- Entry: Next candle close after the crossover — not at the exact cross bar
- Exit: Reverse crossover, or price closes below the faster SMA for two consecutive bars
Dynamic Support and Resistance
In an uptrend, price repeatedly tests and bounces off the SMA. The SMA becomes a dynamic support level — more useful than a fixed horizontal line because it rises with the trend.
False Signals — The Whipsaw Problem
In ranging or choppy markets, price repeatedly crosses above and below the SMA, generating a series of losing crossover signals. This is the most common failure mode.
Section 3: Pass vs. Live — Real-Time Reliability
The SMA value on a live (unclosed) bar updates in real time as price moves. Once the bar closes, the SMA value for that bar is fixed and does not change. There is no repaint risk.
Section 4: Practical Use Cases
Setup: EMA(9) + SMA(20) Signal: EMA(9) crosses SMA(20) in direction of higher-timeframe trend Entry: First candle close after crossover Exit: EMA(9) crosses back, or price closes below SMA(20) Key rule: Only trade crossovers where ADX(14) > 20 on the same timeframe
Setup: SMA(50) + SMA(200) Signal: Price pulls back to SMA(50) in an uptrend (Golden Cross confirmed) Entry: Candle bounces off SMA(50) with volume confirmation Stop: Close below SMA(50) on daily Target: Prior swing high or 2:1 risk-reward
Setup: SMA(200) on weekly chart Signal: Price reclaims SMA(200) after extended time below it Entry: Weekly close above SMA(200) after at least 3 bars below Stop: Weekly close below SMA(200) Target: None fixed — trail stop below SMA(50) weekly
Real example: SPY on 2023-01-13 weekly close above SMA(200) at 396.10 after 9 months below — position entry signal for a multi-month long that ran to 480.
Section 5: Pseudo Code
INPUT: close_prices[], period=20
PROCESS:
Step 1: Require at least `period` bars of data
Step 2: For each bar i starting from index (period - 1):
window = close_prices[i - period + 1 : i + 1]
sma[i] = sum(window) / period
Step 3: Bars before index (period - 1) = NaN (not enough data)
OUTPUT: sma[] — array of SMA values, same length as close_prices[]
EDGE CASES:
- If close_prices has fewer than `period` elements: return all NaN
- NaN in close_prices: propagate NaN for that bar (standard behavior)
- Period = 1: SMA equals raw close (no smoothing)
Section 6: Parameters & Optimization
Standard Period Conventions
| Period | Common Name | Use Case |
|---|---|---|
| 9 | Fast short-term | Intraday momentum, scalping |
| 20 | Monthly average | Short-term trend, dynamic S/R |
| 50 | Quarterly average | Medium-term trend bias |
| 100 | Semi-annual | Institutional positioning reference |
| 200 | Annual average | Long-term trend, bull/bear dividing line |
Parameter Impact
| Change | Effect | When to Apply |
|---|---|---|
| Decrease period | More signals, more false signals, less lag | High-volatility trending markets |
| Increase period | Fewer signals, slower reaction, less noise | Low-volatility or position trading |
| Use Close vs HL2 | Minimal difference — Close is standard | No strong reason to change |
What period works best for crypto?
Crypto markets are more volatile than equities. Standard periods (20, 50, 200) apply on daily charts. On lower timeframes (15m, 1H), reduce period by 20–30%: use SMA(14) instead of SMA(20), SMA(35) instead of SMA(50). The faster cycles require shorter windows.
Does the 200 SMA really matter at institutional level?
Yes — and that is exactly why it works. Hundreds of billions of dollars in algorithmic strategies and institutional mandates reference SMA(200). When price approaches it, those strategies activate. The self-fulfilling nature of the level is the edge, not the math.
Section 7: Synergies & Conflicts
| Works Well With | Avoid Combining With | |
|---|---|---|
| ADX | Confirms trend strength before acting on SMA signal — ADX > 25 = valid trend | — |
| RSI | Times entries within SMA-defined trend — RSI dip to 40-50 in uptrend = entry | — |
| Volume | Confirms SMA bounce with volume spike — low volume bounce = suspect | — |
| MACD | MACD histogram turning positive at SMA support = strong entry confluence | — |
| Bollinger Bands | — | Both use price averages — Bollinger center line IS an SMA. Redundant. |
| EMA of same period | — | SMA(20) and EMA(20) give nearly identical signals. Pick one. |
| Mean reversion oscillators | — | Conflicting philosophy — SMA says trend, oscillator says fade it |
Section 8: Common Mistakes
| Mistake | Root Cause | Solution |
|---|---|---|
| Trading every crossover | Treating SMA as a standalone strategy | Filter with ADX > 20 before entering any crossover |
| Using SMA alone for entry timing | SMA defines trend, not entry timing | Add RSI or Stochastic for entry timing within the trend |
| Picking periods without logic | Arbitrary numbers, over-optimized to history | Stick to standard periods (20, 50, 200) — they work because institutions use them |
| Applying daily SMA to intraday | Timeframe mismatch — daily SMA irrelevant on 1m chart | Match SMA period to the timeframe you are trading |
| Ignoring slope | Flat SMA = no trend, yet still trading crossovers | Only trade crossovers when the slower SMA has a visible slope |
Section 9: Cheat Sheet
USE WHEN: ADX > 20, clear trend visible, looking for dynamic S/R or crossover signal
AVOID WHEN: ADX < 20 (ranging market), news event imminent, earnings within 24H
ENTRY SIGNAL: Price bounces off SMA in uptrend + volume confirm / Fast SMA crosses above slow SMA
EXIT SIGNAL: Price closes below SMA for 2 consecutive bars / Reverse crossover
PARAMETERS: Short-term: SMA(20) | Medium: SMA(50) | Long-term: SMA(200)
CONFLUENCE: ADX (trend strength) + Volume (confirm bounce) + RSI (entry timing)
RISK: High false signal rate in ranging markets — ADX filter is non-negotiable
BEST TIMEFRAME: Works across all timeframes — most reliable on Daily and Weekly