OPEN-SOURCE SCRIPT
Linh Index Trend & Exhaustion Suite

Purpose: One overlay to judge trend, reversal risk, overextension, and volatility squeezes on indexes (built for VNINDEX/VN30, works on any symbol & timeframe).
What it shows
Trend state: Bull / Bear / Transition via 20/50/200 EMAs + slope check.
Overextension heatmap: Background paints when price is stretched vs the 20-EMA by ATR or % (you set the thresholds).
Squeeze detection:
Squeeze ON (yellow dot): Bollinger Bands (20,2) inside Keltner Channels (20,1.5).
Squeeze OFF + Release: White dot; script confirms direction only when close > BB upper (up) or close < BB lower (down).
52-week context: Distance to 52-week high/low (%).
Higher-TF alignment: Optional weekly trend reading shown on the label while you’re on the daily.
Anchored VWAP(s): Two optional AVWAPs from dates you choose (e.g., YTD open, last big gap/earnings).
Plots & labels
EMAs 20/50/200 (toggle on/off).
Optional BB & KC bands for diagnostics.
AVWAP #1 / #2 (optional).
Status label with: Trend, EMAs, Dist to 20-EMA (%, ATR), 52-week distances, HTF state.
Built-in alerts (set “Once per bar close”)
EMA10 ↔ EMA20 cross (early momentum shift)
EMA20 ↔ EMA50 cross (trend confirmation/negation)
Price ↔ EMA200 cross (long-term regime)
Squeeze Release UP / DOWN (BB breakout after squeeze)
Overextension Cool-off UP / DN (stretched vs 20-EMA + momentum rolling)
Near 52-week High (within your % threshold)
How to use (playbook)
Map regime: Prefer trades when Daily = Bull and HTF (Weekly) = Bull (shown on label).
Hunt expansion: Yellow → White dot and close beyond BB = fresh move.
Avoid chasing stretch: If background is painted (overextended vs 20-EMA), wait for a pullback or intraday base.
Locations matter: 52-week proximity + HTF Bull improves breakout quality.
Anchors: Add AVWAP from YTD open or last major gap to frame support/resistance.
Suggested settings
Overextension: ATR = 2.0, % = 4.0 to start; tune per index volatility.
Squeeze bands: BB(20,2) & KC(20,1.5) default are balanced; tighten KC (1.3) for more signals, widen (1.8) for fewer/higher quality.
Timeframes: Daily for signals, Weekly for bias. Optional 65-min for entries.
What it shows
Trend state: Bull / Bear / Transition via 20/50/200 EMAs + slope check.
Overextension heatmap: Background paints when price is stretched vs the 20-EMA by ATR or % (you set the thresholds).
Squeeze detection:
Squeeze ON (yellow dot): Bollinger Bands (20,2) inside Keltner Channels (20,1.5).
Squeeze OFF + Release: White dot; script confirms direction only when close > BB upper (up) or close < BB lower (down).
52-week context: Distance to 52-week high/low (%).
Higher-TF alignment: Optional weekly trend reading shown on the label while you’re on the daily.
Anchored VWAP(s): Two optional AVWAPs from dates you choose (e.g., YTD open, last big gap/earnings).
Plots & labels
EMAs 20/50/200 (toggle on/off).
Optional BB & KC bands for diagnostics.
AVWAP #1 / #2 (optional).
Status label with: Trend, EMAs, Dist to 20-EMA (%, ATR), 52-week distances, HTF state.
Built-in alerts (set “Once per bar close”)
EMA10 ↔ EMA20 cross (early momentum shift)
EMA20 ↔ EMA50 cross (trend confirmation/negation)
Price ↔ EMA200 cross (long-term regime)
Squeeze Release UP / DOWN (BB breakout after squeeze)
Overextension Cool-off UP / DN (stretched vs 20-EMA + momentum rolling)
Near 52-week High (within your % threshold)
How to use (playbook)
Map regime: Prefer trades when Daily = Bull and HTF (Weekly) = Bull (shown on label).
Hunt expansion: Yellow → White dot and close beyond BB = fresh move.
Avoid chasing stretch: If background is painted (overextended vs 20-EMA), wait for a pullback or intraday base.
Locations matter: 52-week proximity + HTF Bull improves breakout quality.
Anchors: Add AVWAP from YTD open or last major gap to frame support/resistance.
Suggested settings
Overextension: ATR = 2.0, % = 4.0 to start; tune per index volatility.
Squeeze bands: BB(20,2) & KC(20,1.5) default are balanced; tighten KC (1.3) for more signals, widen (1.8) for fewer/higher quality.
Timeframes: Daily for signals, Weekly for bias. Optional 65-min for entries.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.