OPEN-SOURCE SCRIPT
Cập nhật

Luxy UT God Mode - UT-Bot Forecast, Signals, Zones and Risk

19 026
Luxy UT God Mode turns the classic UT Bot ATR trailing-stop into a complete, self-contained trading cockpit: momentum-adaptive buy/sell signals, a forward-looking Trend Duration Forecast, auto support/resistance zones, a 0-100 Confidence Score, a built-in multi-currency Risk Calculator, and automatic Stop Loss / Take Profit levels - all on one overlay, all non-repainting.

Note: Every forecast, probability, and statistic in this tool is a calculation based on the chart's own historical behavior. They describe past patterns, not guaranteed future results.

WHAT MAKES THIS DIFFERENT

A normal UT Bot only tells you the trend flipped. Luxy UT God Mode answers the three questions a trader actually asks at the moment of a signal:

1. Should I trust this flip? - a Confidence Score (0-100) blends seven engines into one number.
2. How long might this trend run? - a Trend Duration Forecast projects the expected remaining life of the current trend, drawn as a fading strip with survival-probability milestones.
3. What do I risk and how big do I trade? - automatic Stop Loss, R-based Take Profits, and a position-size calculator in your own account currency.

Everything is layered so you can run it bare-bones (just clean signals) or switch on the full "God Mode" stack.

METHODOLOGY AND CREDITS

This indicator implements proven concepts using entirely original code.

- UT Bot ATR trailing logic - original concept by QuantNomad. This implementation is a significant rework: it adds volume weighting, momentum-adaptive sensitivity, a composite multi-method stop loss, a full multi-filter confirmation stack, multi-timeframe confluence, and the statistical trend-duration engine described below.

Important: this is an educational analysis tool. It does not guarantee any trading result. Always do your own analysis and manage risk.

ảnh chụp nhanh

THE SEVEN ENGINES (and the Confidence Score that fuses them)

Each bar, the script scores how well the current setup aligns and sums it into a single 0-100 Confidence Score with a visual progress bar:

  • UT Bot direction - is price above/below the momentum-adaptive trailing stop
  • SuperTrend - direction plus a distance-from-line strength bonus
  • Market Structure - position inside the recent swing range and structure breaks
  • ADX Regime - is the market trending (signals allowed) or choppy (blocked)
  • Multi-Timeframe - does a higher timeframe agree with the signal direction
  • Volume - is conviction backed by above-average volume
  • RSI Divergence - is a recent divergence supporting or opposing the signal


Read it at a glance: 80+ = strong, 60+ = good, 40+ = weak, under 40 = very weak. Hover the Confidence cell for the full per-engine breakdown.

1. TREND DURATION FORECAST - the headline feature

When the trend flips, the script projects how many more bars the new trend may last, based on the chart's own past trends.

How it works:
  • Every completed trend's duration is recorded, kept separately for bullish and bearish trends.
  • On each new flip the script estimates the expected duration using an exponentially-weighted average and standard deviation (recent trends weighted more heavily).
  • The estimate is drawn as a fading gradient strip that projects forward from the flip, with a "Trend Analysis" label and survival-probability milestones at 25% / 50% / 75% / 90% / 100% of the projection.
  • The percentages are empirical - they show the share of past same-direction trends on THIS chart that actually lasted at least that long. Not a fixed textbook curve.


Three forecast modes:
  • Simple - median duration only. Clean and fast.
  • Standard - exponentially-weighted average plus spread (recommended default).
  • Advanced - Standard plus five adaptive multipliers: Structure (proximity to S/R), Asset Type (volatility profile), Flip Strength (volume + filters passed), Error Learning (self-correction from its own past misses), and Regime (trending vs choppy).


When history is thin, the forecast honestly falls back to a combined estimate and flags it, rather than showing false precision.

ảnh chụp nhanh

2. MOMENTUM-ADAPTIVE UT BOT CORE

The trailing stop is not a fixed ATR multiple. The effective sensitivity adapts each bar to:
  • Momentum - faster momentum widens the trail to stay in strong moves
  • Relative volume - conviction adjusts the distance
  • Asset type - auto-detected (crypto, forex, futures, index, fund, CFD, bond, stock) with a per-class multiplier, or set it manually
  • Volatility mode - Fixed, Dynamic, or Aggressive auto-adjustment to the current volatility regime


The result is a trailing engine that behaves differently on a calm blue-chip than on a volatile small-cap or crypto pair - without you re-tuning it.

3. ANTI-WHIPSAW AND SIGNAL FILTER STACK

Signals only fire when they survive the filters you enable, so you control the trade-off between frequency and quality:
  • ADX Regime - block signals in choppy, non-trending conditions
  • Cooldown and Confirmation - minimum bars between signals and N-bar direction confirmation
  • Swing - only trade aligned with recent swing structure
  • Full Candle - require the whole candle beyond the trailing line (no straddles)
  • Volume, RSI, Hull MA, SuperTrend - optional confirmation layers
  • High-Volatility and % Change - only trade meaningful moves
  • 2-Bar Confirm - extra confirmation for volatile markets


Every active filter appears as a row in the table with a live pass/fail state, so you always know why a flip did or did not become a signal.

4. SUPPORT / RESISTANCE ZONES

The script clusters significant swing pivots into persistent price zones and draws only the two that matter right now: the nearest resistance above price and the nearest support below price. Each zone shows its price and touch count (e.g. "S 4.19 (3x)" = a support tested three times). A level that price has broken through drops off automatically, and an optional Zone Filter can block buys into resistance and sells into support. Pivot strength is adjustable so you can show only major levels.

5. AUTOMATIC STOP LOSS, TAKE PROFIT AND RISK CALCULATOR

On every signal the script draws a complete trade plan:
  • Stop Loss - choose from seven methods: ATR, % based, tick based, swing, scaled ATR, Smart Adaptive (auto-scales to volatility), or Safer (widest of several).
  • Take Profit - TP1 / TP1.5 / TP2 / TP3 as R multiples of the stop distance, with optional price and % labels, and a freeze-on-touch check mark for journaling.
  • Entry line - marks the signal price; all lines can auto-limit to 10 bars for a clean chart.
  • Risk Calculator - enter account size and risk (% or fixed amount) and it returns the position size in shares/contracts, in your own currency, with live FX conversion (USD, EUR, GBP, JPY, CAD, AUD, CHF) or a manual rate.


6. MULTI-TIMEFRAME CONFLUENCE AND RSI DIVERGENCE

The table shows the trend of up to seven higher timeframes (5m, 15m, 30m, 1H, 4H, D, W) via an EMA 9/21 cross, so you can see whether the bigger picture agrees before you act. An optional MTF filter blocks counter-trend signals. Separately, RSI divergence (regular bullish and bearish) is detected, labeled on the chart, and fed into the Confidence Score.

7. LIVE STATUS TABLE

A configurable dashboard (position and size adjustable) summarizes everything: asset type, Confidence Score, adaptive mode, current signal, win-rate / average-bars statistics, multi-timeframe row, divergence, forecast, position size, and one row per active filter - each with a detailed tooltip.

ảnh chụp nhanh

HOW TO USE IT - QUICK START

Step 1 - Add it and pick your sensitivity. Defaults suit intraday (5-15m). For scalping lower the Sensitivity/ATR; for swing raise them (see the Sensitivity tooltip for presets).

Step 2 - Read a signal. A Buy (aqua, below bar) or Sell (orange, above bar) appears only after the bar closes and all enabled filters pass. Check the Confidence Score and the Multi-TF row for context.

Step 3 - Use the trade plan. The Entry, Stop Loss and Take Profit lines draw automatically. Read the Position row for size. Use the Trend Duration Forecast strip as a realistic hold-time expectation - scale out near the median, reassess if price runs past the projection.

Step 4 - Set alerts. Use "Any alert() function call" to receive BUY/SELL and trend-flip alerts on bar close, or pick the specific "Momentum Buy/Sell Signal" conditions. All alerts fire on confirmed bars only.

TUNING FOR MORE OR FEWER SIGNALS

Too few signals: turn off MTF, then Full Candle, then lower the ADX threshold or the Anti-Whipsaw filter. Too many / choppy: raise the ADX threshold, enable Volume and Full Candle, increase Cooldown, or add 2-Bar Confirm. Every filter is independent and shown live in the table.

TECHNICAL NOTES
  • Pine Script v6, overlay, max bars back 5000.
  • No repaint: signals, lines, forecast and alerts are committed on bar close (barstate.isconfirmed); all higher-timeframe data uses lookahead_off.
  • Works on stocks, crypto, forex, futures and indices, on any timeframe.
  • Higher timeframes and longer history produce more reliable forecasts; a new symbol needs a number of completed trends before the duration model is meaningful.


LIMITATIONS
  • Trend-following by nature: signals arrive after a trend establishes, not at exact tops/bottoms.
  • Best in trending conditions; use the ADX regime and filters to avoid chop.
  • The duration forecast needs history to become meaningful and is a statistical estimate, never a guarantee.


DISCLAIMER

This script is an educational analysis tool, not financial advice. Trading stocks, crypto, forex and futures involves substantial risk of loss - you can lose all invested capital. Forecasts, probabilities and win-rate statistics are calculated from historical chart data and do not guarantee future performance. Test on paper first, and you are solely responsible for your own trading decisions.

Feedback and suggestions are welcome in the comments. Happy trading.
Phát hành các Ghi chú
Critical fix + more signals out of the box

• Fixed a runtime error (RE10026) that could blank the indicator on symbols
with long trends. The trend-duration forecast is now safely bounded.
• Fixed a false "SL Touched" that could appear on the entry bar itself.
• Trend Duration forecast: cleaner survival-% (distinct 75/50/25/10), strip
length bounded to real history, labels kept clear of the candles.
• More permissive defaults so Buy/Sell signals appear out of the box:
ADX regime threshold 20 -> 15, Swing Filter and Full Candle now default OFF.
(Re-enable them / raise ADX for fewer, higher-quality signals.)
Phát hành các Ghi chú
What's new in this update

SIGNALS - now appear out of the box
• Every optional filter (Anti-Whipsaw, Swing, Full Candle, Volume, RSI, Hull,
SuperTrend, MTF, S/R Zone) now defaults OFF, so a Buy/Sell prints on every
trend flip, on any asset and timeframe. Enable filters for fewer, stricter
entries.
• Timelier entries: the trailing stop is now a true ratcheting ATR stop that
flips at the turn, instead of the previous smoothed line that lagged and
produced late signals.
• New Smart Chop Filter (Kaufman Efficiency Ratio, on by default): auto-widens
the stop in choppy conditions and tightens it in clean trends, cutting
whipsaw without blocking the signal bar.

EASE OF USE
• 1-click Trading Style presets: Auto / Scalping / Day Trading / Swing /
Position / Custom. Auto tunes Sensitivity, ATR and chop strength from your
chart timeframe; the active style is shown in the dashboard header.
• Confidence % is now printed on each Buy/Sell label (e.g. "Buy 69%"), so a
signal's conviction is visible at the entry, not only in the table.
• The chart stays clean: only the most recent Buy/Sell signals are kept.

DIVERGENCE
• RSI divergence is now merged into the signal as a star marker when it agrees
with a Buy/Sell (higher-conviction reversal) and feeds the Confidence Score.
The separate Bull/Bear divergence labels default OFF (optional).

TREND DURATION FORECAST
• Reworked: anchors to the current bar and trend line (no longer drifts to a
stale level), projects the expected remaining life of the ongoing trend, and
shows a clean declining survival curve; labels sit clear of the candles.

FIXES
• Fixed a false "SL Touched" that could appear on the entry bar itself.
• Fixed forecast probabilities that could read 0% or repeat on low-history assets.
• Various stability and layout fixes.

Note: Educational analysis tool, not financial advice. Historical estimates do
not guarantee future results. Test before trading.
Phát hành các Ghi chú
CLASSIC UT-BOT MODE (new)
• A "Classic UT-Bot Mode" toggle strips every adaptive layer so the trailing
stop is exactly ATR × Sensitivity - identical to the original UT Bot. Use it
to validate against the plain UT Bot, then turn it off for the adaptive engine.

EASE OF USE
• Presets now also set a style-matched Stop Loss (tight for Scalping ATR×1.0,
wide for Position ATR×2.3) instead of one wide default. Take Profits are
R-multiples of the stop, so they scale with it - fixing "SL/TP too wide for
5m/15m".

---------------------------------------------------------------------------------------------------

QUICK START
Leave Trading Style = Auto. It tunes itself to your timeframe. Buy/Sell, Entry,
Stop Loss and Take Profits appear automatically.

BY STYLE (Auto picks these)
• Scalping 1-5m: Sens 1.0 / ATR 7 / Stop ATR×1.0 / strong Chop filter
• Day 15m-1h: Sens 1.5 / ATR 10 / Stop ATR×1.3
• Swing 4h-D: Sens 2.0 / ATR 14 / Stop ATR×1.8
• Position D-W: Sens 2.5 / ATR 20 / Stop ATR×2.3

BY MARKET
• Gold/Oil 5-15m scalping: Scalping (or Auto). Stop still wide? SL Method=ATR,
mult 0.7-0.8 (Custom), or %Based 0.3-0.5%. Keep Smart Chop ON.
• Crypto: Auto; trends run long, forecast cone most accurate (no session gaps).
• Forex/Stocks: Auto; Smart Chop handles the ranges.

MORE / FEWER SIGNALS
• More: lower Sensitivity or use Scalping. Fewer/better: raise Sensitivity,
enable filters, or only take Confidence 60%+ signals.

VALIDATE VS CLASSIC UT BOT
Turn ON Classic UT-Bot Mode + Cooldown 0 + filters OFF, same Key/ATR → matches
the original 1:1. Turn OFF to add the adaptive engine on top.

Phát hành các Ghi chú
Update - signals out of the box, faster core, presets, and fixes

SIGNALS
  • Signals now appear out of the box: every optional filter (Anti-Whipsaw, Swing, Full Candle, Volume, RSI, Hull, SuperTrend, MTF, S/R Zone) defaults OFF, so a Buy/Sell prints on every trend flip, on any asset and timeframe. Enable filters for fewer, stricter entries.
  • Timelier entries: the trailing stop is now a true ratcheting ATR stop that flips at the turn, instead of the previous smoothed line that lagged and produced late signals.
  • New Smart Chop Filter (Kaufman Efficiency Ratio, on by default): auto-widens the stop in chop and tightens it in clean trends, cutting whipsaw without blocking the signal bar.


EASE OF USE
  • 1-click Trading Style presets: Auto / Scalping / Day Trading / Swing / Position / Custom. Auto tunes Sensitivity, ATR, chop strength and the Stop Loss to your chart timeframe; the active style shows in the dashboard header.
  • Preset-matched Stop Loss: tight for Scalping (ATR x1.0) up to wide for Position (ATR x2.3), instead of one wide default. Take Profits are R-multiples of the stop, so they scale with it - fixing "SL/TP too wide for 5m/15m".
  • Confidence % is printed on each Buy/Sell label (e.g. "Buy 69%"), so a signal's conviction is visible at entry, not only in the table.
  • Cleaner chart: only the most recent Buy/Sell signals are kept.


CLASSIC UT-BOT MODE (new)
  • A "Classic UT-Bot Mode" toggle strips every adaptive layer so the trailing stop is exactly ATR x Sensitivity - identical to the original UT Bot by @QuantNomad. Use it to validate 1:1 against the plain UT Bot (same Key/ATR, Cooldown 0, filters OFF), then turn it off for the adaptive engine on top.


DIVERGENCE
  • RSI divergence is merged into the signal as a star marker when it agrees with a Buy/Sell (higher-conviction reversal) and feeds the Confidence Score. The separate Bull/Bear divergence labels now default OFF (optional).


TREND DURATION FORECAST
  • Reworked: anchors to the current bar and current trend line (no longer drifts to a stale level), projects the expected remaining life of the ongoing trend, and shows a clean declining survival curve; header and labels sit clear of the candles.


FIXES
  • Alerts now fire on bar close, in sync with the on-chart labels (previously an alert set to "Once Per Bar" could fire intrabar, before the label appeared or on a flip that didn't hold at close). Alerts are now anti-repaint by construction.
  • Fixed a false "SL Touched" that could appear on the entry bar itself.
  • Fixed forecast probabilities that could read 0% or repeat on assets with little history.
  • Fixed a runtime error that could blank the indicator on symbols with long trends.
  • Various stability and layout fixes.

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.