OPEN-SOURCE SCRIPT
Aggiornato

Microgaps (plots-only, 4-channel, same-day only)

89
Purpose:
This indicator visually highlights 3-bar price gaps on your chart, showing clear visual structure for gap zones without lag or diagonal artifacts.
It draws two outer lines (top and bottom of the gap) for every valid 3-bar gap, and optionally a midline when the gap is considered “large.”

⚙️ How it works

A bull gap is detected when the current bar’s low is higher than the high from two bars ago (low > high[2]).

A bear gap is detected when the current bar’s high is lower than the low from two bars ago (high < low[2]).

The lines are centered at the middle bar of the 3-bar sequence.

Gaps are only drawn within the same trading day to avoid false overnight gaps.

To prevent overlapping artifacts, up to four concurrent gap channels can be drawn efficiently using GPU-friendly plot() lines.

🔵 Midline logic

The midline (center of the gap) is only displayed when the gap’s vertical size is “large” relative to recent volatility.

“Large” means the gap height is greater than a user-defined fraction of the average bar range over the past N bars.

Example: if the average 8-bar range = 2 points, and the threshold = 0.3, then only gaps larger than 0.6 points will show the midline.

🧩 Parameters
Setting Description
Bull Gap Color / Width Style of bullish gaps (top and bottom lines).
Bear Gap Color / Width Style of bearish gaps (top and bottom lines).
Mid Gap Color / Width Style of the optional midline (shown only when “large”).
Large Gap — Lookback (bars) Number of bars used to calculate the average range (default: 8).
Large Gap — Size vs Avg Range Fraction of the average range that defines a “large” gap (default: 0.5). Set lower (e.g. 0.3) to show more midlines.
💡 Tips

Set threshold lower (0.2–0.4) for more midlines, higher (0.6–1.0) to highlight only extreme gaps.

Works best on intraday timeframes (1-min to 30-min).

Fully GPU-efficient — can scroll back thousands of bars without lag.
Note di rilascio
Purpose:
This indicator visually highlights 3-bar price gaps on your chart, showing clear visual structure for gap zones without lag or diagonal artifacts.
It draws two outer lines (top and bottom of the gap) for every valid 3-bar gap, and optionally a midline when the gap is considered “large.”

⚙️ How it works

A bull gap is detected when the current bar’s low is higher than the high from two bars ago (low > high[2]).

A bear gap is detected when the current bar’s high is lower than the low from two bars ago (high < low[2]).

The lines are centered at the middle bar of the 3-bar sequence.

Gaps are only drawn within the same trading day to avoid false overnight gaps.

To prevent overlapping artifacts, up to four concurrent gap channels can be drawn efficiently using GPU-friendly plot() lines.

🔵 Midline logic

The midline (center of the gap) is only displayed when the gap’s vertical size is “large” relative to recent volatility.

“Large” means the gap height is greater than a user-defined fraction of the average bar range over the past N bars.

Example: if the average 8-bar range = 2 points, and the threshold = 0.3, then only gaps larger than 0.6 points will show the midline.

🧩 Parameters
Setting Description
Bull Gap Color / Width Style of bullish gaps (top and bottom lines).
Bear Gap Color / Width Style of bearish gaps (top and bottom lines).
Mid Gap Color / Width Style of the optional midline (shown only when “large”).
Large Gap — Lookback (bars) Number of bars used to calculate the average range (default: 8).
Large Gap — Size vs Avg Range Fraction of the average range that defines a “large” gap (default: 0.5). Set lower (e.g. 0.3) to show more midlines.
💡 Tips

Set threshold lower (0.2–0.4) for more midlines, higher (0.6–1.0) to highlight only extreme gaps.

Works best on intraday timeframes (1-min to 30-min).

Fully GPU-efficient — can scroll back thousands of bars without lag.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.