OPEN-SOURCE SCRIPT
Kinetic Regression Vector

Kinetic Regression Vector (KRV) is a non-repainting direction and compression indicator designed for one job: help you avoid low-quality markets and catch high-quality expansion moves when the odds improve.
Most “prediction” tools either repaint, lag, or pretend they can call exact future prices. KRV doesn’t do that. Instead, it focuses on what actually improves trading outcomes: regime quality, directional bias, and compression-to-expansion timing — all shown visually and locked on closed candles.
What goes into it (what it’s built from)
KRV fits a smooth model to the last N bars of price action and projects that structure forward as a “vector tunnel.”
It uses three core ideas:
Weighted Least Squares (WLS) regression
Recent candles matter more than older ones. That means the model reacts faster when conditions change (important for sector shifts and fast ETF rotations), without using lagging moving averages.
Quality gating with R²
The indicator measures whether the market has been clean and structured recently. If structure is weak (chop/noise), KRV effectively turns itself “off” so you’re not trading randomness.
Model-based uncertainty bands (SEE) with a volatility fallback
Instead of sizing the tunnel only by volatility, KRV can size it by how consistent the model has been. When the model is unreliable, the tunnel widens. When it’s reliable, the tunnel tightens. If you prefer classic behavior, ATR-based band sizing is available as a fallback.
What makes it different (why it stands out)
KRV stands out because it combines features that are usually not together in one tool:
Adaptive, model-driven tunnel width (based on model error when SEE is enabled), instead of a fixed volatility channel that can look “confident” even in messy regimes.
Directional bias that is not a moving-average lag (it’s based on the fitted structure’s slope).
A compression trigger that is self-relative (pinch compares current band width to its own historical baseline, not an arbitrary threshold).
Strict non-repaint design (signals are computed from closed candles so the chart doesn’t lie after the fact).
Forward visualization (the tunnel projects into the future as a reference map, with uncertainty naturally increasing forward).
What you see on the chart
Vector Tunnel: the projected path and the expected noise range around it.
Color: bullish or bearish bias based on the current slope of the model.
Pinch: compression detected (band width unusually tight versus its baseline).
Bull/Bear Bullets: confirmed pinch signals aligned with directional bias.
Target Marker: a forward reference point based on the current structure (not a guarantee, but a useful reference level).
How to use it (simple, repeatable)
Use it as a three-step decision tool:
Gate (participate or stand down):
If the model is not “on” (quality is weak), treat it as a “stay out” signal. This is the most important feature for avoiding bad trades.
Direction (bias):
When the model is on, follow the bias. Bull bias means your edge is on longs. Bear bias means you avoid longs (or only take bearish setups if you trade that way).
Pinch + confirmation (timing):
A pinch means pressure is building. The bullet marks “compression + bias.” For best results, act after you see expansion confirmation (breakout candle / range expansion / level break) rather than treating the bullet as a blind entry.
Best features (why traders keep it)
Non-repainting signals locked to closed bars
Clear “stay out” logic during chop
Direction bias that responds faster than classic lagging tools
Compression detection designed to highlight expansion windows
Forward tunnel for planning risk, entries, and exits visually
Best markets and timeframes
KRV performs best on liquid ETFs and liquid large-cap stocks, and on sector themes like energy where regime shifts matter.
Recommended timeframes:
4H: best for timing entries and avoiding noise
Daily: best for swing direction and higher-quality setups
Weekly: best for big-picture regime filtering (stay out vs participate)
Monthly can be used for macro regime, but not for timing.
What to expect (honest expectations)
KRV is not a guaranteed predictor of exact prices. Its edge comes from:
filtering out weak/noisy regimes,
identifying compression that often precedes expansion,
and aligning that setup with a directional bias,
without repainting.
Most “prediction” tools either repaint, lag, or pretend they can call exact future prices. KRV doesn’t do that. Instead, it focuses on what actually improves trading outcomes: regime quality, directional bias, and compression-to-expansion timing — all shown visually and locked on closed candles.
What goes into it (what it’s built from)
KRV fits a smooth model to the last N bars of price action and projects that structure forward as a “vector tunnel.”
It uses three core ideas:
Weighted Least Squares (WLS) regression
Recent candles matter more than older ones. That means the model reacts faster when conditions change (important for sector shifts and fast ETF rotations), without using lagging moving averages.
Quality gating with R²
The indicator measures whether the market has been clean and structured recently. If structure is weak (chop/noise), KRV effectively turns itself “off” so you’re not trading randomness.
Model-based uncertainty bands (SEE) with a volatility fallback
Instead of sizing the tunnel only by volatility, KRV can size it by how consistent the model has been. When the model is unreliable, the tunnel widens. When it’s reliable, the tunnel tightens. If you prefer classic behavior, ATR-based band sizing is available as a fallback.
What makes it different (why it stands out)
KRV stands out because it combines features that are usually not together in one tool:
Adaptive, model-driven tunnel width (based on model error when SEE is enabled), instead of a fixed volatility channel that can look “confident” even in messy regimes.
Directional bias that is not a moving-average lag (it’s based on the fitted structure’s slope).
A compression trigger that is self-relative (pinch compares current band width to its own historical baseline, not an arbitrary threshold).
Strict non-repaint design (signals are computed from closed candles so the chart doesn’t lie after the fact).
Forward visualization (the tunnel projects into the future as a reference map, with uncertainty naturally increasing forward).
What you see on the chart
Vector Tunnel: the projected path and the expected noise range around it.
Color: bullish or bearish bias based on the current slope of the model.
Pinch: compression detected (band width unusually tight versus its baseline).
Bull/Bear Bullets: confirmed pinch signals aligned with directional bias.
Target Marker: a forward reference point based on the current structure (not a guarantee, but a useful reference level).
How to use it (simple, repeatable)
Use it as a three-step decision tool:
Gate (participate or stand down):
If the model is not “on” (quality is weak), treat it as a “stay out” signal. This is the most important feature for avoiding bad trades.
Direction (bias):
When the model is on, follow the bias. Bull bias means your edge is on longs. Bear bias means you avoid longs (or only take bearish setups if you trade that way).
Pinch + confirmation (timing):
A pinch means pressure is building. The bullet marks “compression + bias.” For best results, act after you see expansion confirmation (breakout candle / range expansion / level break) rather than treating the bullet as a blind entry.
Best features (why traders keep it)
Non-repainting signals locked to closed bars
Clear “stay out” logic during chop
Direction bias that responds faster than classic lagging tools
Compression detection designed to highlight expansion windows
Forward tunnel for planning risk, entries, and exits visually
Best markets and timeframes
KRV performs best on liquid ETFs and liquid large-cap stocks, and on sector themes like energy where regime shifts matter.
Recommended timeframes:
4H: best for timing entries and avoiding noise
Daily: best for swing direction and higher-quality setups
Weekly: best for big-picture regime filtering (stay out vs participate)
Monthly can be used for macro regime, but not for timing.
What to expect (honest expectations)
KRV is not a guaranteed predictor of exact prices. Its edge comes from:
filtering out weak/noisy regimes,
identifying compression that often precedes expansion,
and aligning that setup with a directional bias,
without repainting.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.