TradingView TOTT Strategy: Best Settings, Repaint, Backtest
The short version. This is a TradingView TOTT strategy backtest: Twin Optimized Trend Tracker by KivancOzbilgic, built on Anıl Özekşi's OTT. I ported it line for line to Python and ran the default settings on Exness tick data with real spread and commission: gold and four forex pairs from 2020 to 2026, Bitcoin from 2024, and gold back to 2004.
- Gold since 2020 looks good. PF 1.52 on M15 (333 trades, +3,429 USD per 0.01 lot), 1.44 on H1, 1.25 on H4. Every timeframe was positive.
- Gold from 2004 to 2019 didn't. The same M15 setup made PF 0.99 over sixteen years while gold rose 266%. H4 went backwards.
- Almost all of the profit came from the long side. Shorts lost money on gold H1, H4 and D1, on USDJPY and on Bitcoin.
- Forex mostly lost or broke even. EURUSD, GBPUSD and NZDUSD: PF 0.79 to 1.10 on M5 to H4, with one exception (GBPUSD H1, 1.30 on 89 trades) that didn't beat random timing.
- The "twin" part doesn't help. Splitting OTT into two lines cut trades by about a quarter and raised PF in 11 of 18 cases, lowered it in 7.
My verdict: TOTT is a slow trend follower that rode the 2020s gold rally. I didn't find an edge beyond that.
What is the TOTT strategy on TradingView?
It's a moving average that flips the trade when it crosses a trailing band set 1% away from itself. The Twin Optimized Trend Tracker Strategy was published by KivancOzbilgic on 10 January 2023 (Pine v5) and had 8,819 boosts when I checked in November 2026. The idea comes from Anıl Özekşi, who designed OTT for Turkish stocks. The script page links his video "Toy Borsacı İçin OTT Kullanım Kılavuzu 2" and says the twin lines are there "to cope with sideways' false signals".
Here's the core of the code with the defaults (OTT period 40, optimization constant 1, twin coefficient 0.001, VAR average):
MAvg = getMA(src, length) // VAR: EMA scaled by |CMO(9)|
fark = MAvg * percent * 0.01
longStop := MAvg > longStopPrev ? math.max(longStop, longStopPrev) : longStop
shortStop := MAvg < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop
MT = dir == 1 ? longStop : shortStop
OTT = MAvg > MT ? MT * (200 + percent) / 200 : MT * (200 - percent) / 200
OTTup = OTT * (1 + coeff)
OTTdn = OTT * (1 - coeff)
buySignalk = ta.crossover(MAvg, OTTup[2])
sellSignalk = ta.crossunder(MAvg, OTTdn[2])
In plain words:
- The support line is VAR, the Variable Index Dynamic Average. It's an EMA whose speed depends on the 9-bar Chande Momentum Oscillator, so it nearly stops moving when price goes sideways.
- The stop sits 1% below that line in an uptrend and only ever moves up, like a trailing stop. In a downtrend it sits 1% above and only moves down.
- The twin lines are that stop shifted up 0.1% and down 0.1%.
- The signals fire when the support line itself (not price) crosses the upper twin line from two bars ago (buy) or the lower one (sell). The strategy is always in the market and reverses on each signal. No stop loss, no take profit.
So it's a cousin of SuperTrend and PMax, not of Bollinger Bands: the band is a fixed percent of price, not volatility, and it ratchets in one direction.
Here's what that looks like on gold H1:

Three small losses in August, then one long from 3,389.79 on 26 August held for eight weeks and closed at 4,111.27 on 21 October: +721 USD per 0.01 lot. It gave back about 270 from the top before the support line turned. That's the trade TOTT exists for.
The 1% band is wide. On gold M5 it made only 656 trades in six and a half years, and on H4 just 60. Every result below should be read with that in mind.
Does TOTT repaint?
No. It decides at the bar close and fills at the next bar's open, and the [2] on the OTT lines looks back, not forward. The barssince calls only colour the chart and place labels; they don't touch the orders. One quirk: VAR starts at zero on the first bar of the chart and climbs slowly, so the first few signals on a short chart history are meaningless. On TradingView's normal history that's long gone before the bars you care about. I started VAR at the first price and skipped 100 bars. Starting from zero instead moved gold H1 and H4 by 0.01 to 0.05 PF, but some forex H4 cells (40 to 50 trades) moved by up to 0.2, which tells you how little those cells are worth.
How I tested it
- Port: Python, line for line, reusing the VAR and trailing-band code from my PMax port. Signals at the bar close, fills at the next bar's open, stop-and-reverse like
strategy.entry. A repeated buy while already long is ignored, as in Pine. - Data: Exness Raw Spread tick archives for XAUUSD, EURUSD, GBPUSD, USDJPY and NZDUSD, January 2020 to September 2026. BTCUSD from January 2024 to October 2026.
- 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. Swap gets its own section.
- 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?
For TOTT, mostly yes. The script has no commission and TradingView can't model spread or swap (more on that in the SuperTrend backtest), but TOTT trades so rarely that costs barely move it:
| Default settings, long + short | Trades | PF, no costs | PF, real costs |
|---|---|---|---|
| Gold M15 | 333 | 1.54 | 1.52 |
| EURUSD M5 | 355 | 0.91 | 0.89 |
| USDJPY M5 | 415 | 1.04 | 1.01 |
| BTCUSD M5 | 707 | 1.04 | 1.02 |
Swap is the cost that matters here, because trades last days. It's further down.
The results
Profit factor after spread and commission, default settings:

The D1 column has 5 to 19 trades per cell. Ignore it. USDJPY H4 (1.54) is 37 trades.
Gold (XAUUSD Raw Spread), 29 Jan 2020 – Sep 2026, before swap:
| Timeframe | Direction | Trades | Win rate | PF | Net | Max drawdown |
|---|---|---|---|---|---|---|
| M5 | long + short | 656 | 38.1% | 1.24 | +2,443 | 1,095 |
| M15 | long + short | 333 | 38.7% | 1.52 | +3,429 | 1,280 |
| H1 | long + short | 141 | 37.6% | 1.44 | +1,871 | 969 |
| H4 | long + short | 60 | 31.7% | 1.25 | +756 | 1,662 |
| M15 | long only | 166 | 44.0% | 2.03 | +3,013 | 952 |
| H1 | long only | 70 | 44.3% | 2.14 | +2,236 | 1,073 |
| Buy and hold | 1 | +2,588 | 1,629 |
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.

Look at the M15 line next to buy and hold. They move almost together from 2024 on. On M15 the long side made +3,013 and the short side +416; on H1 and H4 the shorts lost 365 and 883.
Forex, Bitcoin and USDJPY, long + short, after costs:
| M5 | M15 | H1 | H4 | |
|---|---|---|---|---|
| EURUSD | 0.89 | 1.04 | 1.10 | 0.95 |
| GBPUSD | 0.93 | 0.91 | 1.30 | 0.90 |
| NZDUSD | 0.79 | 0.81 | 0.94 | 0.97 |
| USDJPY | 1.01 | 0.92 | 1.17 | 1.54 |
| BTCUSD (2024–26) | 1.02 | 0.96 | 1.10 | 0.99 |
USDJPY tells the same story as gold. It rose for most of the period, the long side made the money (H4 longs +4,215 pips, shorts −790), and the long-only version did better than the default.
Is the gold M15 result real?
It passed one test that most of these strategies fail, then failed the one that matters.
- Every year was positive. Gold M15 by exit year: 2020 PF 1.82, 2021 1.16, 2022 1.02, 2023 1.22, 2024 1.42, 2025 2.00, 2026 1.56. But 2025 and 2026 made +2,481 of the +3,429.
- It beat random timing. I slid the strategy's own long/short pattern to a random point in time, 300 times, keeping every trade's length. Only 2.3% of the random copies did as well (p = 0.023). Gold H1 and H4 didn't pass (p = 0.17 and 0.31), and neither did USDJPY H4 (0.22), GBPUSD H1 (0.17) or anything else I tried. One pass out of twelve tries is borderline.
- A handful of trades carry it. The ten best trades made +3,655. The other 323 lost 226 together.
- Before 2020 it broke even. Below.
Does TOTT work on gold before 2020?
No. I ran the same defaults on Dukascopy gold from 2004 to 2019. I hadn't looked at that data when I picked M15.
| Gold, 2004–2019 | Trades | PF after swap | Summed return | Long / short |
|---|---|---|---|---|
| M5 long + short | 1,476 | 1.08 | +62% | +86% / −25% |
| M15 long + short | 808 | 0.99 | −1% | +56% / −57% |
| H1 long + short | 336 | 1.07 | +61% | +87% / −27% |
| H4 long + short | 144 | 1.14 | −15% | +47% / −62% |
| H1 long only | 168 | 1.23 | +87% |
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. H4 shows PF above 1 in dollars but a loss in percent because its winning longs came at higher gold prices, which count for more in dollars.

The M15 line, the best one since 2020, ended 2019 roughly where it started in 2004. The long side made money while gold rose, and the short side gave it back. The same random-timing test on 2004–2019 H4 gave p = 0.37 for long + short and 0.39 for long only, which means no better than chance.
What are the best TOTT settings?
On recent gold almost anything works, and on older gold almost nothing stands out. I ran OTT period 10, 20, 40, 80 and 160 against optimization constant 0.2, 0.5, 1, 1.5, 2 and 3%, with twin coefficient 0, 0.001 and 0.003. That's 90 combinations per market and timeframe, long + short, after costs:
| Market | Combos with PF > 1 | Profitable in both halves | Median PF |
|---|---|---|---|
| XAUUSD M15, 2020–26 | 82 / 90 | 68 | 1.27 |
| XAUUSD H1, 2020–26 | 78 / 90 | 56 | 1.34 |
| XAUUSD H4, 2020–26 | 74 / 90 | 36 | 1.46 |
| USDJPY H4 | 80 / 90 | 58 | 1.54 |
| EURUSD H1 | 37 / 90 | 11 | 0.97 |
| GBPUSD H1 | 55 / 90 | 31 | 1.06 |
| NZDUSD H1 | 30 / 90 | 1 | 0.87 |
| BTCUSD H1 | 49 / 90 | 36 | 1.02 |
| XAUUSD M15, 2004–19 | 68 / 90 | 9 | 1.04 |
| XAUUSD H4, 2004–19 | 32 / 90 | 15 | 0.96 |
"Both halves" = profitable in the first and second half of the data. For 2004–19 the halves are 2004–2011 and 2012–2019.

That's the clearest picture in this review. The same 30 settings on the same market: pale grey from 2004 to 2019, blue from 2020 on. The settings didn't get better. Gold started trending, and any trend follower on the long side makes money when it does. If you optimize TOTT on recent gold, you're fitting the rally.
Does the twin line help?
Not in any consistent way. Setting the coefficient to 0 gives you plain OTT, one line. Here's the default 0.001 against that:

The twin lines did what the description says: fewer trades in 17 of 18 cases, typically 20–30% fewer. Whether that helped is a coin flip. Gold M15 went from 1.23 to 1.52, GBPUSD H1 from 1.42 to 1.30, USDJPY H1 from 1.36 to 1.17.
How does it compare with UT Bot, Hull Suite, PMax and SuperTrend?
On gold since 2020, TOTT has the best H1 number of the five. Same Exness data, same costs, default settings, long + short:
| Gold, Jan 2020 – Sep 2026 | H1 PF | H4 PF |
|---|---|---|
| TOTT | 1.44 | 1.25 |
| UT Bot | 1.04 | 1.17 |
| Hull Suite | 1.28 | 1.25 |
| PMax | 1.37 | 0.98 |
| SuperTrend | 1.09 | 1.90 |
But all five are trend followers tested on the same rising market, and the three I took back to 2004 (UT Bot, Hull Suite, TOTT) all looked much weaker before 2020. A higher number here mostly means the strategy stays long longer.
Risk structure
- No stop loss. A trade closes only when the support line crosses the opposite twin line, which is slow. The worst gold M15 trade was a sell at 4,591.33 on 2 April 2026, closed at 4,818.45 on 7 April: −227 USD per 0.01 lot, about 5% of price.
- Whipsaws come in runs. That sell was followed by a buy that lost 165 and another sell that lost 129, −521 in twelve days:

- Nine of the ten worst gold M15 trades were between October 2025 and August 2026, losing 121 to 227 each. A fixed lot risks more as gold gets more expensive.
- Swap. Gold M15 trades last 175 hours on average, the longest 1,308. Raw-account swap on longs, scaled to price, takes M15 from PF 1.52 to 1.45, H1 from 1.44 to 1.33 and H4 from 1.25 to 1.10.
- Losing streaks. The longest on gold M15 was 10 trades. The win rate is 31–44% everywhere.
- What isn't a red flag: no martingale, no grid, no averaging.
Who should use it?
If you already want to be long gold and you'd like a rule for when to step aside, TOTT on M15 or H1 is a reasonable, slow filter. It cut the worst stretches of buy and hold and kept most of the upside since 2020. As a long + short system with the defaults, it lost on most forex, its short side lost money on every market that trended up, and its best gold result broke even for sixteen years before 2020. I wouldn't run it as an automated strategy.
What I couldn't verify
- TradingView's own report. My numbers come from my port. I didn't export TradingView's strategy tester results to compare trade by trade.
- Turkish stocks. OTT was designed for BIST shares, often on daily bars. I only had forex, gold and Bitcoin ticks.
- Forex swap. Not included in the forex numbers. It wouldn't rescue PF 0.79.
- Bitcoin before 2024. Under three years of Exness BTC ticks.
- Daily candles. Mine close at UTC midnight; TradingView forex daily bars usually close at 17:00 New York. With 10–19 trades per D1 cell, it doesn't matter much.
Bottom line
The TradingView TOTT strategy doesn't repaint, and with default settings it made money on gold (M15 PF 1.52) and USDJPY since 2020 almost entirely from the long side, then broke even on gold from 2004 to 2019. The twin line doesn't change that. It's a slow trend filter, not an edge.
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 UT Bot backtest uses the same data if you want to compare.
I'm not affiliated with TradingView, KivancOzbilgic or Anıl Özekşi. 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.