OPEN-SOURCE SCRIPT
Pivot point moving averages

Pivot Point Moving Averages builds moving averages from confirmed pivots, not from every bar.
Instead of averaging all highs and lows, this script:
Because the lines only move when a new pivot is confirmed, they represent structural acceptance rather than raw volatility. Short “noise” moves and stop hunts between pivots have much less impact on these averages.
You can also enable an optional second pivot MA cloud:
Why it’s useful
Traditional MAs:
This tool uses confirmed pivots, so it is better suited to market structure and phase analysis:
Typical interpretations:
With the second cloud enabled on a higher timeframe, you can:
Notes
Instead of averaging all highs and lows, this script:
- Detects swing pivot highs and pivot lows using a configurable Pivot length (pivotLen).
- Converts these sparse pivot prices into continuous series of:
- last confirmed pivot low
- last confirmed pivot high
- Applies a user-selectable moving average (SMA / EMA / RMA / WMA / VWMA) to each of those pivot series.
- Plots the two resulting lines and shades the area between them as a pivot value cloud.
Because the lines only move when a new pivot is confirmed, they represent structural acceptance rather than raw volatility. Short “noise” moves and stop hunts between pivots have much less impact on these averages.
You can also enable an optional second pivot MA cloud:
- Uses the same Pivot length for structural detection.
- Has its own MA length and type.
- Can run on a different timeframe (e.g. D, 240, W).
- Is projected back onto the current chart so you see local pivot value and higher-timeframe pivot value together.
Why it’s useful
Traditional MAs:
- React to every bar.
- Move on noise, wicks, and stop runs.
- Don’t distinguish between “meaningful” structure and random fluctuation.
This tool uses confirmed pivots, so it is better suited to market structure and phase analysis:
- Pivot MA low reflects how demand is stepping up (or down) as new swing lows form.
- Pivot MA high reflects how supply is pressing down (or easing) as new swing highs form.
- The cloud between them acts as a dynamic, structure-based value area.
Typical interpretations:
- Price inside the pivot cloud → balance / fair value area.
- Price above the pivot cloud → bullish value expansion.
- Price below the pivot cloud → bearish value expansion.
- Cloud compressing → possible energy build-up, transition between phases.
- Cloud expanding → stronger directional conviction.
With the second cloud enabled on a higher timeframe, you can:
- See whether lower-timeframe structure is building with or against the higher-timeframe pivot value.
- Use the HTF cloud as a background bias and the LTF cloud for timing and fine-grained context.
Notes
- All pivot-based tools have inherent delay: a pivot is only confirmed after pivotLen bars to the right.
- On very low timeframes, long pivotLen + long MA lengths will make the lines slower to react.
- This is intended as a context and structure tool, not a standalone entry signal.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.