liveBook · Manning

Moving average ribbon

As explained in Investing for Programmers

A moving average ribbon is a visualization containing multiple moving-average lines calculated over different time windows.

A moving average ribbon plots several moving averages over the closing price, using different time windows to reveal trend strength. Narrow ribbons indicate consolidation; wide ribbons indicate stronger trends. section 10.2.2 section 10.4

Choose the averaging method and window according to the analysis goal:

  • Use SMAs for slower, long-term trend analysis. section 10.2.2
  • Use EMAs for quicker reactions and short-term strategies. section 10.2.2
  • Use WMAs for signals that emphasize recent prices, or HMAs for smoother rapid-trend detection with reduced lag. section 10.2.2

Six-window ribbon

A Python workflow retrieves NVIDIA history with yfinance, calculates SMAs for 10, 20, 30, 40, 50, and 60 days using pandas rolling windows, and plots them with matplotlib. The ribbon contracts around May and October 2024, indicating market consolidation.

How Investing for Programmers covers it

How deep it goes
Defines ribbon construction and interpretation, but defers optimal trading-window selection to deeper strategy analysis.
Examples
Plots six NVIDIA SMA windows—10 through 60 days—and observes ribbon contraction around May and October 2024.
What you can do after
Apply it via pandas, matplotlib, and yfinance to calculate and plot multi-window moving-average ribbons.
How it connects
Connects SMAs, EMAs, WMAs, HMAs, closing prices, consolidation, Bollinger Bands, and MACD.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Investing for Programmers. The section links point to the parts of the book it draws on.