LA - KC_EMA_BB

• A hybrid price + variance system that combines three Keltner-style bands (KC1, KC2, KC3) drawn on the price chart (different lengths: long / medium / short), plus a separate “variance” pane that measures the difference between two of those midlines and shows momentum/volatility context with EMAs and Bollinger Band-like bounds.
• The indicator runs as overlay = false (so by default the variance pane is separate) but selectively draws some things on the main price chart (KC midlines, KC band fills, and it even re-draws the candles). That gives you a dual-view: a price overlay + a separate analytic pane.
What the script actually plots / computes
1. Three “KC mid” lines — each mid is an EMA of the chosen source (default hl2) at three configurable lengths (defaults in the script: 288, 144, 24). Each midline is colored green/red/black depending on its direction (up/down/flat).
2. Three EMA bands — instead of using ATR to make Keltner bands, the script calculates EMA of high and EMA of low (for each length) and fills between them. The fill color flips depending on whether the EMA high is falling or rising.
3. Variance pane (configurable visibility):
• A variance series computed as the difference between two EMA mids (the code intends KC1 vs KC3 variance — more below about naming/possible bug). The script divides the difference by 100 (so the variance is scaled down).
• Two EMAs applied to the variance (fast & slow) for trend/momentum detection.
• A Bollinger-style band around the variance (SMA ± mult * stdev).
• Plots, fills and background coloring in the pane to highlight bullish/bearish zones:
Green fills when variance > slow EMA, red fills when variance < slow EMA.
Background turns solid green/red when variance and both EMAs and the BB basis align bullish/bearish.
4. Multi-timeframe support — everything (both the KC data and variance calculations) is computed via request.security(..., i_timeFrame, ...), so the user can view higher-timeframe KC/variance while sitting on a lower timeframe chart.
5. Re-draw candles — the script calls plotcandle(..., force_overlay = true) to re-draw candles on top of the overlay elements so candles remain visible.
Visual legend (what each color/area means)
• KC Midlines
Green = mid is rising (bullish)
Red = mid is falling (bearish)
Black = flat/unchanged
• KC Band fills (price overlay)
Light green fill = band/upper-EMA is rising (bullish band)
Pink/red fill = band/upper-EMA is falling (bearish band)
• Variance pane
Variance line (main oscillator) — colored green if rising, red if falling
Slow EMA (variance) — colored similarly (directional)
Fast EMA (variance) — colored similarly
BB Median (basis) — color indicates basis direction (up/down)
Fill between variance & slow EMA — green when variance > slow EMA, red when variance < slow EMA
Fill between BB median & fast EMA — green when momentum > median, red when < median
Background color (panel)
Green = variance, both EMAs and bb basis are bullish (strong momentum)
Red = variance, both EMAs and bb basis are bearish (strong bearish momentum)
Grey = mixed / no clear momentum
________________________________________
Quick read — what to look for
1. Trend alignment on price: KC3 (short) above KC2 above KC1 and all three green → higher-timeframe bullish alignment. Reverse for bearish.
2. Band behavior: Price hugging upper band and mids rising → trending continuation. Price stuck inside bands and fills narrow → low volatility / squeeze.
3. Momentum confirmation (variance pane):
Strong bullish: variance > fast EMA > slow EMA > BB median (panel green).
Strong bearish: variance < fast EMA < slow EMA < BB median (panel red).
Weak / pullback: variance crosses below fast or slow EMA but BB median unchanged → possible pullback within trend.
________________________________________
Suggested entry rules (simple & practical)
Long (conservative)
• Higher-TF alignment: KC1 & KC2 green and rising (trend confirmed).
• Variance pane: variance > slow EMA and fast EMA; panel not red (prefer green or grey → ideally green).
• Price pulls to KC3 mid (or EMA(low) band) and shows rejection (bullish candle).
• Confirm with variance not falling (variance slope >= 0) at entry.
Short (conservative)
• Higher-TF: KC1 & KC2 red and falling.
• Variance pane: variance < slow EMA and fast EMA; panel red preferred.
• Price rallies up to KC3 mid / upper band and shows rejection (bearish candle).
• Confirm variance slope <= 0.
Faster (aggressive) entries
• Use cross of variance over/under fast EMA for quick entries when price already aligns with KC mid direction. (Higher false positive risk.)
________________________________________
Suggested exit rules
• Take profit partial on next KC mid in the direction of the trade (e.g., long: take 50% at KC2 if entered near KC3).
• Exit full if variance crosses back across the slow EMA in the opposite direction or panel turns opposite color.
• Tight stop: below/above recent swing low/high or outside KC band (use ATR multiple for volatility-based stop).
________________________________________
Risk management (practical)
• Risk per trade ≤ 1–2% of account.
• Position size = Risk amount ÷ (entry − stop) in price units.
• If variance panel shows weak momentum (grey), reduce size or avoid new positions.
________________________________________
Recommended default setup (starting point)
• Timeframe for request.security: set to a higher TF than chart (e.g., chart 15m + i_timeFrame = 1H) for trend context.
• Lengths: KC1=288 (long), KC2=144 (mid), KC3=24 (short).
• BB length & mult: keep default then adjust if instrument is noisy (lower mult for tighter BB).
• Turn on: Show KC1-3, Show Slow/ Fast EMA, Show BB Median, Show Background Color.
Tập lệnh chỉ hiển thị cho người được mời
Chỉ những người dùng được tác giả đồng ý mới có thể truy cập tập lệnh này. Bạn cần yêu cầu và xin phép sử dụng tập lệnh này. Quyền truy cập thường được cấp sau khi thanh toán. Để biết thêm chi tiết, hãy làm theo hướng dẫn của tác giả bên dưới hoặc liên hệ trực tiếp với aravindleo_99.
TradingView KHÔNG khuyến khích trả tiền hoặc sử dụng tập lệnh trừ khi bạn hoàn toàn tin tưởng tác giả và hiểu cách hoạt động của tập lệnh. Bạn cũng có thể tìm thấy các giải pháp thay thế miễn phí, mã nguồn mở trong mục tập lệnh cộng đồng của chúng tôi.
Hướng dẫn của tác giả
Thông báo miễn trừ trách nhiệm
Tập lệnh chỉ hiển thị cho người được mời
Chỉ những người dùng được tác giả đồng ý mới có thể truy cập tập lệnh này. Bạn cần yêu cầu và xin phép sử dụng tập lệnh này. Quyền truy cập thường được cấp sau khi thanh toán. Để biết thêm chi tiết, hãy làm theo hướng dẫn của tác giả bên dưới hoặc liên hệ trực tiếp với aravindleo_99.
TradingView KHÔNG khuyến khích trả tiền hoặc sử dụng tập lệnh trừ khi bạn hoàn toàn tin tưởng tác giả và hiểu cách hoạt động của tập lệnh. Bạn cũng có thể tìm thấy các giải pháp thay thế miễn phí, mã nguồn mở trong mục tập lệnh cộng đồng của chúng tôi.