OPEN-SOURCE SCRIPT

Gann Mass Pressure

457
█ OVERVIEW

The Gann Mass Pressure indicator projects a seasonal price forecast for the remainder of the calendar year. It averages historical closes from the same calendar date across multiple past decades to produce a composite trend line that extends forward from the current bar through December 31. The method was documented by Constance Brown in The 32nd Jewel: Gann Analysis, Part 2, Price and Time (Chapter VII, Section L), reproducing W.D. Gann's original six-term formula with lookback intervals of 10, 20, 30, 40, 60, and 80 years.


HOW IT WORKS

For each calendar date, the indicator:

1 — Identifies the month and day.
2 — Looks back to that same calendar date at each of the six configurable intervals
(default: 10, 20, 30, 40, 60, and 80 years).
3 — Finds the closest matching trading day within a ±15-bar scan window
to handle weekends, holidays, and calendar drift.
4 — Averages all available (non-na) closes into a single Mass Pressure value.

On historical bars, this value is plotted as a colored line (gold when rising, blue when falling). On the last bar, the indicator generates a forward projection by computing Mass Pressure for every remaining weekday through December 31 and drawing it as a continuous line extending beyond the chart's current data. A label marks the final projected value at year-end.

The info table in the top-right corner shows each lookback term's resolved value, the bar count required to reach it, and whether it is active, unavailable, or beyond Pine Script's history limit. A forecast row displays the number of projected data points.


HOW TO USE

The forward projection line is the primary output. It maps the dominant seasonal tendency for the rest of the year based on the composite behavior of the selected historical intervals. When the projection trends upward, historical precedent favors rising prices for that calendar period. When it trends downward, the seasonal composite points to weakness.

Recommended timeframe: Weekly. On weekly charts, all six Gann lookback intervals (including the 60-year and 80-year terms) resolve within Pine Script's 10,000-bar history limit, giving you the complete formula as Gann intended. On daily charts, only the 10-year, 20-year, and 30-year terms will typically be available due to the bar limit. The indicator handles this gracefully and plots with whatever terms resolve, but fewer terms reduce the composite's reliability.

Confluence with other timing methods: Brown notes that Mass Pressure maps seasonal trends under normal conditions and is not suited for precise timing. It is most powerful when used in confluence with independent timing methods (cycle analysis, planetary geometry, Gann time counts) to confirm or filter signals from those primary tools.

Key inputs:
Lookback 1 through 6: The six year intervals. Defaults match Gann's original
formula (10, 20, 30, 40, 60, 80). Adjustable for experimentation.
Min valid terms to plot: The minimum number of non-na lookback values required
before the indicator will plot. Default is 2. Increase to 3 or 4 for higher
confidence from more contributing terms.
Smoothing: Optional SMA smoothing applied to the historical Mass Pressure line.
Default is 1 (no smoothing). Increase to reduce noise on volatile instruments.
Forecast line color: Separate color for the forward projection (default: gold
with slight transparency to distinguish it from the historical plot).
Colors and line width: Customizable rising/falling/flat colors and line thickness.


LIMITATIONS

Pine Script 10,000-bar history cap. Pine enforces a maximum of 10,000 bars for any history-referencing operator. At approximately 252 trading days per year on daily charts, this caps effective lookback depth at roughly 39 years. The 40-year term is borderline, and the 60-year and 80-year terms will return na on daily timeframes. Switching to weekly charts (52 bars/year) brings the 80-year lookback down to approximately 4,160 bars, well within the limit.

Insufficient chart data. The indicator will not appear on charts where the symbol lacks enough historical price data to satisfy the minimum number of lookback terms. Newer instruments (ETFs, crypto, recent IPOs) may have less than 10 years of data, in which case no terms resolve and nothing plots. The background shades red when available terms fall below the configured minimum. The info table always shows exactly which terms are active and which are not.

Calendar-date matching is approximate. The scan window of ±15 bars around the target offset matches the nearest available trading day when the exact calendar date falls on a weekend or holiday. In rare cases at the boundary of long market closures, the matched date could be slightly offset from the true anniversary.

Forward projection uses weekday estimates. The forecast line generates dates for Monday through Friday via Zeller's congruence. It does not account for market-specific holidays (e.g., Thanksgiving, exchange closures), so the projected point count may slightly exceed the actual number of remaining trading days.

Seasonal trend, not timing. As Brown notes, this indicator maps seasonal tendencies under normal conditions. It does not predict exact turning points. Divergences between Mass Pressure direction and actual price often occur around major non-seasonal events. The Time Factor and independent timing tools should always take precedence for entry/exit decisions. Brown also observes that for some instruments (Soybeans is cited), the indicator may display an inverse relationship to actual market trends.


NOTES

The formula and methodology are drawn directly from Constance Brown's The 32nd Jewel: Gann Analysis, Part 2, Price and Time (Chapter VII, Section L). Brown provides worked examples for DJIA and Cotton, documents the six default lookback intervals, and includes critical caveats about data sufficiency, seasonal-year offsets, and the distinction between seasonal trend indication and precise timing.

The info table provides full transparency into the indicator's internal state. Red "OVER 10K" entries indicate that a lookback exceeds Pine's bar limit at the current timeframe. Red "n/a" entries indicate the chart does not have data going back that far. Green term counts confirm the indicator is computing with adequate data. The forecast row shows the number of forward-projected points through December 31.

Background shading on historical bars provides an additional visual cue: a faint yellow tint indicates computation with fewer than all six terms, and a faint red tint indicates the term count has fallen below the configured minimum threshold.


THANKS

Constance Brown, for her meticulous documentation of Gann's methods in The 32nd Jewel. Her treatment of the Mass Pressure Chart, including its strengths, limitations, and the critical warning about data sufficiency, made this implementation possible.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.