Trend Confirmation Scanner [Quantum Edge]This script is Quantum Edge Trend Confirmation Scanner Indicator (Trend Confirmation Scanner). It detects Bollinger Band / Keltner Channel squeezes and then measures momentum while color-coding rising vs falling strength.
What it’s built from
Bollinger Bands (BB)
Uses a simple moving average (sma) of close over length (default 20) as the basis.
Standard deviation (stdev) of price over the same length is multiplied by mult (though here multKC is actually used in the code) to get the BB width.
upperBB and lowerBB are basis ± deviation.
Keltner Channels (KC)
Uses an SMA (ma) of close over lengthKC (default 20).
The channel width is an average of either True Range (tr) or (high - low) over lengthKC, controlled by useTrueRange.
upperKC and lowerKC are ma ± rangema * multKC.
Squeeze state
Squeeze ON (sqzOn): Bollinger Bands are inside the Keltner Channels (BB narrower than KC).
Squeeze OFF (sqzOff): Bollinger Bands are outside the Keltner Channels (BB wider than KC).
No squeeze: neither ON nor OFF, meaning BB and KC roughly overlap.
Momentum calculation
The core momentum value val is a linear regression over lengthKC of a de-meaned price:
source
−
average
(
highest high
,
lowest low
,
SMA close
)
source−average(highest high,lowest low,SMA close)
over the same window.
This approximates how price is moving relative to a local range midline; positive values imply bullish momentum, negative imply bearish.
Plot styling and colors
val is plotted as a histogram:
Bright lime: val > 0 and increasing (bullish momentum rising).
Dark green: val > 0 but decreasing (bullish but weakening).
Bright red: val < 0 and decreasing (bearish momentum increasing).
Dark maroon: val < 0 but increasing (bearish but weakening).
A horizontal zero line is plotted with different colors to show squeeze state:
Blue: no squeeze (normal volatility).
Black: squeeze ON (BB inside KC, volatility contraction, potential buildup).
Gray: squeeze OFF (release after squeeze, volatility expansion).
How to interpret it
Use the zero-line dots to know if the market is in a volatility squeeze (black), has just released (gray), or is in a neutral state (blue).
Use the histogram bars to gauge direction and strength of momentum:
Green/lime above zero: bullish bias, with lime indicating acceleration.
Red/maroon below zero: bearish bias, with red indicating acceleration.
Typical usage: watch for a black squeeze transitioning to gray/blue while the histogram flips from red to green or vice versa, as a potential breakout / trend-start signal.
Pine Script®指标






















