OPEN-SOURCE SCRIPT
Actualizado Microgaps (plots-only, 4-channel, same-day only)

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.
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.
Notas de prensa
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.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.