UT Bot Alerts: settings, source and repainting checks
UT Bot Alerts marks source-price crossings of an ATR trailing stop. Start with QuantNomad's public script, then check the multiplier, candle source and alert timing before comparing signals. An open-bar label can disappear before the candle closes.
Educational information, not investment advice. Signals and syntax checks do not establish profitability or execution quality.
Identify the script before changing settings
The original publication credits Yo_adriiiiaan for the initial UT Bot indicator and HPotter for the original code idea. QuantNomad published the alert version. A matching title from another author can contain different filters, stop rules or confirmation logic.
QuantNomad announced UT Bot v2 in June 2026 as a separate release with an integrated strategy. This page audits the 2020 alert indicator. Its defaults and code example should not be assumed to describe every later fork or strategy.
| Setting | Default | What it controls |
|---|---|---|
| Key Value | 1 | ATR multiplier. With ATR 1.5, keys 1 and 2 give candidate offsets 1.5 and 3 price units. |
| ATR Period | 10 | Length of the chart-based ATR. Changing it changes the volatility estimate, not a fixed number of signal bars. |
| Heikin Ashi signals | Off | Switches the signal source from chart close to same-timeframe Heikin Ashi close. |
No universal best settings are established here. A larger Key Value widens the candidate offset for a given ATR, but the actual stop also depends on its previous value and the price path. Evaluate changes on the same data and reserve a separate period for testing any trading rule with costs.
Follow the trailing-stop calculation
Let S be the selected source, P the previous stop and D = Key Value × ATR. If both the current and previous S are above P, the stop is max(P, S − D). If both are below P, it is min(P, S + D). Otherwise it resets to S − D when S is above P, or S + D when it is not. Equality follows this last branch.
The source crosses the updated stop to produce a signal. The original uses a one-period EMA of S, which equals S when available. A buy requires an upward crossover and S above the stop; a sell requires the reverse. Merely remaining above the stop colors a bar but does not create a fresh buy on every bar.
| Previous S / P | Current S | Updated stop | Signal |
|---|---|---|---|
| 99 / 100 | 101 | 101 − 3 = 98 | Buy crossover |
| 101 / 98 | 102 | max(98, 102 − 3) = 99 | No new signal |
| 102 / 99 | 98 | 98 + 3 = 101 | Sell crossover |
These are arithmetic examples after initialization, not market returns. The stop is recursive, so different history, warm-up bars or missing data can change comparisons. The line is an indicator value; it does not submit a protective order.
Keep Heikin Ashi source and ATR separate
On standard candles, turning on the script's HA option replaces S with Heikin Ashi close. It does not move the ATR calculation into the HA request. Changing the entire chart to Heikin Ashi changes the chart OHLC used by ATR too, so the two configurations need not match.
For a standard candle with O = 100, H = 104, L = 98 and C = 103, HA close is (100 + 104 + 98 + 103) / 4 = 101.25. Against a previous stop of 102, regular close is above the stop and HA close is below. That can select a different update branch. Previous source and stop values are still needed to determine a crossover.
TradingView documents HA prices as synthetic. They are not executable market prices. Start comparisons on standard time-based candles, record the HA switch separately, and test fills using actual market prices.
Check intrabar signals against the close
Take the first example again: previous S = 99 and P = 100. During the new bar, S reaches 101 and the provisional stop becomes 98 with D = 3, producing a buy. If S closes at 99.5, the same previous-bar state gives min(100, 99.5 + 3) = 100. The closed bar has no buy crossover. An intrabar alert may already have fired. D is held constant here to isolate the mechanism; live ATR can change during the bar as well.
The original code has no confirmation gate. Its disabled lookahead does not prevent the current HA close, chart close or ATR from changing. Realtime recalculation explains disappearing open-bar markers without implying future-data leakage.
- Add the original script and record its author, inputs, symbol, session, timeframe and chart type.
- Create an alert for UT Long or UT Short. Choose Once Per Bar Close when the rule requires a closed candle.
- Create the other direction separately if needed. Adding the indicator alone does not create a running alert.
- After changing code, inputs or chart context, delete and recreate affected alerts. TradingView runs a saved snapshot.
- Log live alert timestamps and closed-bar values, then reload the chart and compare. Historical labels alone cannot verify intrabar alerts.
Timing and snapshot behavior: TradingView alert documentation. Waiting for the close delays the decision and does not remove sideways-market reversals, data revisions or execution costs.
Pine Script v6 confirmation example
This educational adaptation preserves the referenced trailing formula and adds a plotted stop, positive input bounds, a warm-up gate and optional close confirmation. Use standard candles. Confirmation is on by default for labels, bar colors and alert conditions; the plotted stop remains provisional on the open bar. It is not QuantNomad's official v6 release.
//@version=6
// Educational adaptation of UT Bot Alerts by QuantNomad.
// Original indicator: Yo_adriiiiaan; original code idea: HPotter.
// Source: https://www.tradingview.com/script/n8ss8BID-UT-Bot-Alerts/
// Adds a visible stop and optional close confirmation. Not the author's release.
indicator("UT Bot: source and confirmation check", overlay=true)
keyValue = input.int(1, "Key Value (ATR multiplier)", minval=1)
atrPeriod = input.int(10, "ATR Period", minval=1)
useHeikinAshi = input.bool(false, "Signals from Heikin Ashi close")
confirmedOnly = input.bool(true, "Confirm signals at bar close")
// Use standard time-based candles. ATR follows the chart OHLC.
atrValue = ta.atr(atrPeriod)
lossDistance = keyValue * atrValue
haClose = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead=barmerge.lookahead_off)
src = useHeikinAshi ? haClose : close
float trailingStop = 0.0
previousStop = nz(trailingStop[1], 0.0)
if src > previousStop and src[1] > previousStop
trailingStop := math.max(previousStop, src - lossDistance)
else if src < previousStop and src[1] < previousStop
trailingStop := math.min(previousStop, src + lossDistance)
else if src > previousStop
trailingStop := src - lossDistance
else
trailingStop := src + lossDistance
signalSource = ta.ema(src, 1)
crossUp = ta.crossover(signalSource, trailingStop)
crossDown = ta.crossover(trailingStop, signalSource)
ready = not na(atrValue) and not na(trailingStop[1])
showSignal = ready and (not confirmedOnly or barstate.isconfirmed)
buy = showSignal and src > trailingStop and crossUp
sell = showSignal and src < trailingStop and crossDown
// The stop remains provisional on the open bar, even in confirmation mode.
plot(trailingStop, "ATR trailing stop", color=color.blue, linewidth=2)
plotshape(buy, "Buy", shape.labelup, location.belowbar, color.green, text="Buy", textcolor=color.white, size=size.tiny)
plotshape(sell, "Sell", shape.labeldown, location.abovebar, color.red, text="Sell", textcolor=color.white, size=size.tiny)
barcolor(showSignal ? (src > trailingStop ? color.green : src < trailingStop ? color.red : na) : na)
alertcondition(buy, "UT Long", "UT Long: {{ticker}} {{interval}}")
alertcondition(sell, "UT Short", "UT Short: {{ticker}} {{interval}}")Paste into the Pine Editor, add to the chart and compare closed bars with the reference using identical settings. Syntax validation does not prove signal parity. Turning confirmation off permits provisional labels; the alert dialog still controls alert frequency. Sideways price crossings can alternate buy and sell repeatedly, and gaps can move executable prices beyond a plotted stop.
UT Bot Alerts FAQ
Sources and further checks
Verified October 17, 2026. Calculations above are illustrative, not backtest results.
- QuantNomad: UT Bot Alerts and public source
- QuantNomad: UT Bot v2 release announcement (June 14, 2026)
- TradingView: alerts, saved snapshots and alert frequency
- TradingView: Heikin Ashi and non-standard chart data
- TradingView: repainting and changing realtime values
- TradingView: bar confirmation states
- TradingView: Heikin Ashi candle formulas
Continue with ATR calculation, compare Supertrend, or return to TradingView indicator guides.
Specify the change before editing the script
Pineify's Pine Script AI Coding Agent can help edit source you are permitted to use. Provide the visible code and a precise requirement, such as adding close confirmation while preserving the source and ATR context. Review the changes, request a syntax check and compare chart values before relying on the result. This workflow does not unlock protected scripts or execute trades.
Review the Pine Script AI Coding Agent