OPEN-SOURCE SCRIPT
Обновлено 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.
Информация о релизе
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.
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.
Скрипт с открытым кодом
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.