OPEN-SOURCE SCRIPT
Gap Detector [MS]

This indicator helps traders identify and visualize price gaps in market data. When price movements create gaps between trading sessions or periods, the script highlights these areas with colored clouds and markers.
Key Features:
Use it For:
How it Works:
The script compares each bar's opening price with the previous bar's closing price. A gap is identified when the opening price is significantly different from the previous close (beyond the user-defined gap percentage). The gap area is then marked with a colored cloud:
Settings:
This indicator can help traders:
The script is designed to work across all timeframes and markets.
Key Features:
- Automatically detects price gaps based on a customizable gap percentage threshold
- Visualizes gaps using color-coded clouds (green when price moves upward, red for downward price action)
- Places small triangle markers at gap locations for easy identification of gaps, and if many happen close together
- Shows gray clouds when price is within the last gap
Use it For:
- Watching for gap-fills
- Gap support/resistance levels
- Trading gap breakouts
- ...and more
How it Works:
The script compares each bar's opening price with the previous bar's closing price. A gap is identified when the opening price is significantly different from the previous close (beyond the user-defined gap percentage). The gap area is then marked with a colored cloud:
- Green clouds: Show gaps where price jumped higher
- Red clouds: Show gaps where price dropped lower
- Gray clouds: Indicate price action within the gap
Settings:
- Gap %: Controls the minimum price difference required to identify a gap (default 0.01 or 1%)
This indicator can help traders:
- Identify potential support/resistance levels at gap areas
- Monitor gap-filling scenarios
- Spot significant price movements between trading sessions
The script is designed to work across all timeframes and markets.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
For script access or PineScript questions, please visit our site:
marketscripters.com?utm_source=tradingview&utm_medium=signature
marketscripters.com?utm_source=tradingview&utm_medium=signature
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
For script access or PineScript questions, please visit our site:
marketscripters.com?utm_source=tradingview&utm_medium=signature
marketscripters.com?utm_source=tradingview&utm_medium=signature
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.