TradingView UT Bot Strategy: Heikin Ashi Backtest Is Fake
The short version. This TradingView UT Bot strategy backtest starts with the Heikin Ashi trap: on an HA chart the strategy looks like a money machine, and at real prices it isn't. It also covers the settings and repainting. The script is UT Bot Strategy by QuantNomad, one of the most-boosted open-source strategies on TradingView. I ported it line for line to Python and ran it on Exness tick data with real spread and commission: five forex and gold markets from 2020 to 2026, Bitcoin from 2024, and gold back to 2004.
- The Heikin Ashi chart backtest is fake. Put the strategy on a Heikin Ashi chart and it shows PF 8.6 to 11.5 with 65–69% winners on every market and timeframe I tried (gold, EURUSD, Bitcoin, M5 to H4). Fill the same signals at real prices and it's PF 0.90 to 1.19 with 35–38% winners. The table and the equity chart below show both side by side.
- Forex lost money on every timeframe. EURUSD, GBPUSD, NZDUSD and USDJPY: profit factor 0.52 to 1.00 from M5 to D1 after costs.
- Gold H4 is the only real positive. PF 1.17 on 1,219 trades, +2,245 USD per 0.01 lot. But 2020 to 2022 lost money, and the ten best trades made more than the whole result.
- Gold 2004–2019, data I didn't use to pick H4: PF 1.00. Sixteen years of break-even.
- M5 and M15 lose everywhere. About 35–40 trades a day, and the spread eats all of it.
My verdict: UT Bot is a plain ATR trailing stop that flips long and short. It doesn't have an edge on its own. If you've seen a UT Bot backtest with a 70–90% win rate, check the chart type first.
What is the UT Bot strategy on TradingView?
It's a trailing stop that sits one ATR away from price and flips the trade when a candle closes on the other side of it. The UT Bot Strategy page is QuantNomad's strategy version of the "UT Bot" indicator by Yo_adriiiiaan, which credits HPotter for the idea. It's dated 15 November 2019, Pine v4, and had 9,114 boosts when I checked in November 2026. The "UT Bot Strategy with Backtesting Range" by the same author has identical rules plus a date filter, so this review covers both.
Three inputs: Key Value (default 1), ATR Period (default 10) and a checkbox Signals from Heikin Ashi Candles (off). Here's the core of the Pine code:
xATR = atr(c)
nLoss = a * xATR
xATRTrailingStop := iff(src > nz(xATRTrailingStop[1], 0) and src[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), src - nLoss),
iff(src < nz(xATRTrailingStop[1], 0) and src[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), src + nLoss),
iff(src > nz(xATRTrailingStop[1], 0), src - nLoss, src + nLoss)))
...
buy = src > xATRTrailingStop and crossover(ema(src, 1), xATRTrailingStop)
sell = src < xATRTrailingStop and crossover(xATRTrailingStop, ema(src, 1))
strategy.entry("long", true, when = buy)
strategy.entry("short", false, when = sell)
In plain words: while price stays above the line, the line moves up to close − Key × ATR and never moves down. When a close drops below it, the line jumps above price and starts following it down. Each crossing is a buy or a sell. ema(src, 1) is just the close itself. There's no stop loss or take profit. The line is the stop, but it's only checked at the candle close, and the strategy is always in the market, long or short.
Here's what that looks like on gold H4 with the defaults:

Gold went from about 3,350 to 4,350 in those eight weeks. UT Bot still flipped short 15 times, because a stop one ATR away gets hit by any normal pullback. The longs made +557 USD per 0.01 lot, the shorts lost 387, so it kept +171 of a 1,000-dollar move.
In a range it's worse:

Twelve trades in three weeks, net −234. That's the whole pattern of this strategy in two pictures.
Should you use UT Bot on Heikin Ashi candles?
Use the checkbox if you like, but don't put the strategy on a Heikin Ashi chart. The author says the same thing on the script page: "Do not add this strategy to HA candles, use usual candles and this checkbox." This is where most of the amazing UT Bot backtests on YouTube come from, so it's worth showing why.
Heikin Ashi candles aren't real prices. The HA open is the average of the previous HA open and close, so it lags the market. When the strategy runs on an HA chart, TradingView fills the orders at those HA prices unless you change the fill setting in the strategy properties. So the backtest buys at a price that's usually below where the market actually was, and sells above it. I ran the same signals both ways, no costs, as TradingView shows by default:
| No costs | Strategy on an HA chart | Same signals at real prices |
|---|---|---|
| XAUUSD H1 | PF 11.26, 67% winners | PF 1.12, 36% winners |
| XAUUSD H4 | PF 10.81, 68% | PF 1.19, 38% |
| EURUSD M15 | PF 9.99, 67% | PF 0.94, 36% |
| EURUSD H4 | PF 11.52, 69% | PF 1.05, 38% |
| BTCUSD M5 | PF 9.39, 66% | PF 1.04, 36% |
| BTCUSD H1 | PF 10.15, 66% | PF 1.01, 36% |
Exness ticks, gold and EURUSD Jan 2020 – Sep 2026, BTCUSD Jan 2024 – Nov 2026, Key 1 and ATR 10.
It doesn't matter what market or timeframe you pick. The HA chart turns a coin flip into a money printer, and none of that money exists:

And the checkbox, which reads the HA close but trades at real prices, doesn't rescue anything either. After costs: gold H1 1.10, gold H4 1.18, EURUSD M5 to H1 0.70 to 0.85, BTCUSD M5 to H4 0.90 to 0.98.
Does UT Bot repaint?
No, not on normal candles. The strategy decides at the bar close and fills at the next bar's open. The Heikin Ashi option uses security() on the same timeframe with lookahead = false, so it doesn't look ahead on historical bars either. The line on the live, unfinished candle can move while the candle is open, which is why the signal sometimes appears and disappears in real time. The strategy only acts once the bar closes. The thing that misleads people isn't repainting. It's the HA chart fills above.
What does the author claim?
Nothing about performance. QuantNomad says they took Yo_adriiiiaan's code, cleaned it up, moved it to Pine v4, made a strategy from it and added the Heikin Ashi checkbox. There are no profit claims, no suggested market and no suggested timeframe. So I tested the defaults across everything I had.
How I tested it
- Port: Python, line for line, including Pine's
nz(stop[1], 0)start-up and the RMA-basedatr(). Signals at the bar close, fills at the next bar's open, stop-and-reverse likestrategy.entry. - Data: Exness Raw Spread tick archives for XAUUSD, EURUSD, GBPUSD, USDJPY and NZDUSD, January 2020 to September 2026. BTCUSD from January 2024 to November 2026, which is all the tick history I have for it.
- Costs: buys fill at the real ask on the first tick of the bar, sells at the bid, plus 3.5 USD per lot per side on forex and gold, 1 USD per BTC per side on Bitcoin. Swap gets its own line further down.
- Older gold data: Dukascopy M1 bars via Tickstory, 2004 to July 2026, spread from the data, swap on longs scaled to the gold price of the time.
- Size: fixed, no compounding. Gold in USD per 0.01 lot (one ounce), forex in pips, Bitcoin in USD per 1 BTC.
Is the TradingView backtest accurate?
The signals, yes. The money, no, and less so the lower the timeframe. The script sets no commission and TradingView's tester can't model spread or swap (I went through this in the SuperTrend backtest). UT Bot trades a lot, so this matters more than usual:
| Default settings, long + short | Trades | PF, no costs | PF, real costs | Net, no costs → real |
|---|---|---|---|---|
| Gold M5 | 61,372 | 1.00 | 0.90 | +286 → −9,527 USD |
| Gold H4 | 1,219 | 1.19 | 1.17 | +2,437 → +2,245 USD |
| EURUSD M5 | 68,889 | 0.90 | 0.66 | −17,660 → −76,718 pips |
| USDJPY M15 | 20,362 | 1.00 | 0.83 | +587 → −26,370 pips |
| BTCUSD M5 | 36,295 | 1.02 | 0.90 | +78,215 → −384,201 USD |
On a TradingView-style test, gold M5 and BTC M5 look like small winners. With the spread they're the worst results in the whole study.
The results
Profit factor after spread and commission, default Key 1 / ATR 10:

Red everywhere below H1. Forex stays red on every timeframe. The blue cells are gold H4/D1 and Bitcoin D1, and the Bitcoin D1 cell has 109 trades in under three years, which is too few to trust.
Gold (XAUUSD Raw Spread), 29 Jan 2020 – Sep 2026, before swap:
| Timeframe | Direction | Trades | Win rate | PF | Net | Max drawdown |
|---|---|---|---|---|---|---|
| M5 | long + short | 61,372 | 33.1% | 0.90 | −9,527 | 11,026 |
| M15 | long + short | 19,483 | 34.2% | 0.93 | −4,100 | 4,383 |
| H1 | long + short | 4,565 | 35.7% | 1.04 | +931 | 1,099 |
| H4 | long + short | 1,219 | 37.2% | 1.17 | +2,245 | 809 |
| H4 | long only | 609 | 39.2% | 1.38 | +2,413 | 816 |
| D1 | long + short | 239 | 42.3% | 1.07 | +459 | 1,807 |
| Buy and hold | 1 | +2,591 | 1,579 |
Net and drawdown in USD per 0.01 lot, drawdown on open equity. "Long only" isn't a script setting; I added it to see where the money came from.

The shorts lost money on gold on every timeframe. On H4 they cost 168, so the long-only version did slightly better than the default, and neither beat buying gold and holding it.
Is the gold H4 result real?
Probably not, or at least not in a way you could count on. Four things point the same way:
- It all came from two years. Gold H4 by exit year: 2020 PF 0.96, 2021 0.97, 2022 0.84, 2023 1.20, 2024 0.98, 2025 1.35, 2026 1.38. The 2025–2026 profit (+2,380) is bigger than the six-and-a-half-year total.
- A handful of trades carry it. The ten best trades made +2,460. The other 1,209 trades lost 216 together.
- Random timing comes close. I slid the strategy's own long/short pattern to a random point in time, 300 times. Same trades, same holding times, no link to price. The real result (+2,245) beat most copies (median −3), but 6.6% of the random copies did as well or better. Gold H1 was weaker: 19% of random copies beat it.
- Before 2020 it broke even. Below.
Does it work on gold before 2020?
No. I ran the default settings on Dukascopy gold from 2004 to 2019, a period I hadn't looked at when choosing H4. The spread in that data is wider than an Exness Raw account, so the low timeframes get hit even harder, but H4 and D1 shouldn't care much.
| Gold, 2004–2019 | Trades | PF after swap | Summed return |
|---|---|---|---|
| M5 long + short | 134,789 | 0.61 | −4,421% |
| M15 long + short | 42,685 | 0.74 | −1,523% |
| H1 long + short | 10,297 | 0.89 | −333% |
| H4 long + short | 2,694 | 1.00 | −11.5% |
| H4 long only | 1,347 | 1.05 | +50% |
| D1 long only | 284 | 1.16 | +67% |
Fixed size, no compounding. "Summed return" adds each trade's profit as a percent of its entry price. Gold itself rose 266% over the period.

The long-only line made a little while gold was rising (2004–2011) and gave some back after. The default long + short line went nowhere for sixteen years and was still negative in 2024. Only the 2025 rally pulled it up.
What are the best UT Bot settings?
There aren't any that hold up. I ran Key 0.5, 1, 1.5, 2, 3 and 4 against ATR 1, 3, 5, 10, 14, 20 and 50, with and without the Heikin Ashi checkbox. That's 84 combinations per market and timeframe, long + short, all after costs:
| Market | Combos with PF > 1 | Profitable in both halves | Median PF |
|---|---|---|---|
| XAUUSD M15 (long + short) | 37 / 84 | 6 | 0.98 |
| XAUUSD H1 | 76 / 84 | 39 | 1.08 |
| XAUUSD H4 | 84 / 84 | 48 | 1.18 |
| EURUSD M15 | 0 / 84 | 0 | 0.84 |
| EURUSD H1 | 5 / 84 | 3 | 0.87 |
| USDJPY H1 | 57 / 84 | 42 | 1.03 |
| NZDUSD H1 and H4 | 0 / 84 | 0 | 0.87 |
| BTCUSD H1 | 9 / 84 | 6 | 0.95 |
"Both halves" = profitable in the first and in the second half of the data. Halves for gold are Jan 2020 – May 2023 and May 2023 – Sep 2026.
Gold H4 looks great until you split it. Here are the 42 settings without Heikin Ashi, each half on its own:

A bigger Key (3 or 4) means a looser stop, so the strategy stays in the trend longer. That's exactly what paid in the 2024–2026 rally (PF mostly 1.7 to 2.4). In 2020 to mid-2023, when gold chopped around, the same settings made 0.73 to 1.24. Key 4 with ATR 14 went from 0.73 to 2.06. If you optimize UT Bot on recent gold data you'll pick a big Key, and you'll be picking the last rally.
On 2004–2019 gold the grid says the same: median PF 1.02 on H4 and 0.97 on H1, and only a few settings made money in both 2004–2011 and 2012–2019.
How does it compare with Hull Suite, PMax and SuperTrend?
It's the weakest of the four on gold. Same Exness data, same costs, default settings, long + short:
| Gold, Jan 2020 – Sep 2026 | H1 PF | H4 PF |
|---|---|---|
| UT Bot | 1.04 | 1.17 |
| Hull Suite | 1.28 | 1.25 |
| PMax | 1.37 | 0.98 |
| SuperTrend | 1.09 | 1.90 |
All four are trend followers. The difference is mostly how far the stop sits from price, and UT Bot's default of one ATR is the tightest.
Risk structure
- No stop loss beyond the line, and the line only counts at the close. The worst gold H4 trade was a buy at 4,725.86 on 20 March 2026, closed at 4,553.56 twelve hours later: −172 USD per 0.01 lot, after being 249 underwater.
- Whipsaws come in pairs. On 29 January 2026 a short at 5,182.88 lost 123, and the buy that replaced it lost 109 by the next morning.
- Nine of the ten worst gold H4 trades were in 2026, with gold at 4,000 to 5,300. A fixed lot risks more as price rises.
- Swap. Gold H4 trades last 48 hours on average (longest 284). Swap on longs, scaled to price, takes gold H4 from +2,245 to +1,815 (PF 1.14).
- Losing streaks. The longest run of losers on gold H4 was 10 trades. The win rate is 37%. That's normal for trend following, but you need the big winners to show up, and in 2020–2022 they mostly didn't.
- What isn't a red flag: no martingale, no grid, no averaging.
Who should use it?
Honestly, I wouldn't trade it as a strategy. As a visual trailing stop for trades you take for other reasons, a bigger Key (2 to 4) on H4 or higher is reasonable, and it's simple to read. As an automated system with the defaults, it lost on forex, lost below H1 everywhere, and only made money on gold H4 because of the 2025–2026 rally. If you want a trend filter for gold, Hull Suite held up better on the same data.
What I couldn't verify
- TradingView itself. My HA-chart numbers come from my port, filling at HA open prices the way TradingView's default does. I didn't export TradingView's own report.
- Forex swap. Not included in the forex numbers. It wouldn't turn PF 0.66 into a winner.
- Bitcoin before 2024. I only have Exness BTC ticks from January 2024, so the BTC results cover under three years.
- Other brokers, stocks and indices. Exness data only, forex, gold and Bitcoin only.
- Daily candles. Mine close at UTC midnight; TradingView forex daily bars usually close at 17:00 New York.
Bottom line
The TradingView UT Bot strategy doesn't repaint and doesn't make money with its default settings: forex lost on every timeframe, M5 and M15 lost everywhere, and gold H4 (PF 1.17) came from one rally and broke even from 2004 to 2019. The 70–90% win-rate backtests come from running it on a Heikin Ashi chart, where it fills at prices that never traded.
This is part of a series where I take the most-boosted open-source TradingView strategies, port them exactly and test them on broker ticks with real costs. The Hull Suite backtest uses the same data if you want to compare.
I'm not affiliated with TradingView, QuantNomad, Yo_adriiiiaan or HPotter. Past results, including backtests, don't guarantee future results.
Comments
No comments yet. Questions about the settings, the data or the numbers are welcome.
Log in or create a free account to comment.