The short version. This is a TradingView AlphaTrend strategy backtest. KivancOzbilgic's "AlphaTrend Strategy" has about 7,200 boosts. I ported it to Python and ran it on Exness tick data for seven markets, M5 to D1, with real spread and commission, from January 2020 to September 2026.

  • As a stand-alone long + short strategy, it has no edge of its own. EURUSD, GBPUSD and NZDUSD lost on every timeframe from M5 to H4 after costs.
  • Where it made money, the long side did the work. Gold H4: PF 1.47, +2,336 USD per 0.01 lot. Longs made +2,484, shorts lost 148. Holding gold made +2,591 over the same period.
  • Long only, it kept pace with buy and hold at half the drawdown. Gold H4 long only: +2,484 with a 757 max drawdown, versus 1,579 for holding. It was out of the market 47% of the time.
  • The volume in MFI barely matters. With the same prices and volume set to 1 on every bar, 96–99% of bars ended up in the same position. You can stop worrying about which broker's tick volume you use.
  • On old data it went flat. Dukascopy gold 2004–2019, H4 long + short: PF 1.03.

My take: use AlphaTrend as a trend filter or trailing level, long side, on markets that trend. Don't run the strategy script as written and expect the shorts to pay.

What is the AlphaTrend strategy on TradingView?

It's the open-source strategy version of Kıvanç Özbilgiç's AlphaTrend indicator, version 2.0 published 9 January 2023. Here's all of the code that trades:

ATR = ta.sma(ta.tr, AP) // AP = 14 upT = low - ATR * coeff // coeff = 1 downT = high + ATR * coeff AlphaTrend := (novolumedata ? ta.rsi(src, AP) >= 50 : ta.mfi(hlc3, AP) >= 50) ? (upT < nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : upT) : (downT > nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : downT) buySignalk = ta.crossover(AlphaTrend, AlphaTrend[2]) sellSignalk = ta.crossunder(AlphaTrend, AlphaTrend[2]) if (buySignalk) strategy.entry("Long", strategy.long) if (sellSignalk) strategy.entry("Short", strategy.short) 

Two things in there aren't obvious from the chart.

The line is a ratchet. While MFI is at or above 50, the line can only move up to low − ATR, never down. When MFI drops below 50, it can only move down to high + ATR. That's why it sits flat for long stretches: the new level wasn't better than the one it already held.

The second line is the same line, two bars ago. The red line on the chart isn't a slower average. So a "crossover" just means the ratchet changed direction in the last two bars. There's no second opinion involved.

There's no stop loss and no exit. Each signal closes the old position and opens the opposite one, so the strategy is in the market about 98% of the time.

AlphaTrend on XAUUSD H4, 22 September to 24 October 2025: candles, the AlphaTrend line in blue and the same line two bars ago in red, green background while long and red while short, MFI 14 below with the 50 line, Exness tick data

That's a good month for it. One buy on 22 September held through the whole rise from about 3,690 to above 4,300. The line stepped up while MFI stayed above 50 and sat flat when it dipped. MFI went under 50 around 18 October, the line started falling a few days later, and the sell gave back part of the top.

Does AlphaTrend repaint?

Not after the bar closes. The line uses the current bar's high, low and MFI, so on a live bar it can move and a signal can appear and then disappear before the close. Once the bar closes, the value is final. I take signals on the close and fill at the next bar's open, the same way TradingView's tester does by default.

How I tested it

  • Port: Python, signal on the close, fill at the next open, stop-and-reverse like strategy.entry. Default settings: ATR period 14, multiplier 1, MFI on hlc3.
  • Volume: MFI needs volume, so I used the number of ticks per bar. That's what retail forex volume is on TradingView and MetaTrader too.
  • Data: Exness Raw Spread ticks for XAUUSD, USDJPY, EURUSD, GBPUSD, NZDUSD and US500, January 2020 to September 2026. BTCUSD from January 2024.
  • Costs: buys fill at the real ask on the bar's first tick, sells at the bid, plus 3.5 USD per lot per side for forex and gold.
  • Swap: checked separately for gold (below). Not included in the main tables.
  • Older data: Dukascopy M1 via Tickstory, 2004 to 2026, for gold and four forex pairs, with Dukascopy's own tick counts as volume.
  • Size: fixed, no compounding. Gold in USD per 0.01 lot (1 oz), forex in pips per lot, US500 in index points, Bitcoin in USD per 1 BTC.

The results

AlphaTrend Strategy profit factor after costs by market and timeframe, long plus short and long only, XAUUSD USDJPY EURUSD GBPUSD NZDUSD US500 BTCUSD, M5 to D1, with trade counts, Exness Raw Spread ticks 2020 to 2026

XAUUSD, Jan 2020 – Sep 2026, before swap. Buy and hold: +2,588, max drawdown 1,600.

Timeframe Trades PF Net Max DD Win rate Long net Short net Long only: PF / net / DD
M5 12,041 0.97 −1,260 2,434 34% +663 −1,923 1.03 / +663 / 958
M15 3,823 1.09 +2,040 868 35% +2,312 −272 1.21 / +2,312 / 710
M30 1,885 1.13 +2,095 926 35% +2,341 −247 1.30 / +2,341 / 763
H1 940 1.22 +2,438 740 37% +2,510 −72 1.49 / +2,510 / 526
H4 265 1.47 +2,336 820 39% +2,484 −148 2.08 / +2,484 / 757
D1 51 2.53 +2,560 809 43% +2,406 +154 4.76 / +2,406 / 809

USD per 0.01 lot. Look at the net column. From M15 to D1 it lands between +2,040 and +2,560 every time, right around the +2,588 that holding gold made. That's what a long-biased trend follower does in a market that doubled.

USDJPY, Jan 2020 – Sep 2026. Buy and hold: +4,845 pips.

Timeframe Trades PF Net Max DD Win rate Long net Short net Long only: PF / net / DD
M5 13,193 0.87 −15,318 15,892 33% −5,239 −10,079 0.91 / −5,239 / 5,589
M15 4,074 1.05 +2,972 2,385 35% +3,911 −940 1.12 / +3,911 / 1,326
M30 1,981 1.05 +2,098 3,009 36% +3,489 −1,391 1.16 / +3,489 / 1,840
H1 970 1.16 +4,920 2,139 38% +4,854 +66 1.31 / +4,854 / 1,689
H4 288 0.97 −624 3,957 33% +2,161 −2,785 1.26 / +2,161 / 1,681
D1 44 1.82 +4,291 1,932 43% +4,799 −508 4.61 / +4,799 / 1,191

Pips per lot, swap not included.

The other five markets, long + short:

Market M5 M15 M30 H1 H4 D1 Buy and hold
EURUSD 0.83 0.87 0.93 0.95 0.87 1.13 +304 pips
GBPUSD 0.81 0.90 0.93 0.89 0.81 1.22 +214 pips
NZDUSD 0.71 0.85 0.99 0.88 0.74 0.96 −821 pips
US500 0.97 1.00 1.02 0.92 0.89 1.05 +4,437 pts
BTCUSD* 0.93 0.96 1.02 1.04 1.23 0.85 +41,139 USD

Profit factor after spread and commission, no swap. *BTCUSD January 2024 – September 2026. Long only on US500 was 1.04–2.42 across timeframes, and on Bitcoin H4 1.46, both still behind holding.

The forex majors went sideways for six years, and AlphaTrend lost on them. Gold, yen, the S&P and Bitcoin went up, and AlphaTrend made money on the long side. That's the whole pattern.

AlphaTrend equity on XAUUSD H4 and USDJPY H1: long plus short, long only, the short side alone and buy and hold, January 2020 to September 2026, Exness Raw Spread ticks, spread and commission included, swap not included

The red line is the short side on its own. On gold it bled for five years, lost about 900, then got most of it back in the 2026 sell-off. On USDJPY it finished at +66 pips after six years of work.

Should you turn on "no volume data"?

It barely matters. That surprised me more than anything else in this test.

The script has a switch called "Change calculation (no volume data)?". Off, the filter is MFI, which weighs each bar by volume. On, it's RSI, which only uses closes. People worry about it because forex "volume" is just a tick count, and every broker's feed counts differently.

So I kept the Exness prices fixed and swapped only the volume: Exness tick counts, Dukascopy tick counts, and a flat 1 on every bar (which removes volume completely).

AlphaTrend profit factor on the same Exness prices with three volume feeds, Exness tick volume, Dukascopy tick volume and volume equal to 1, for XAUUSD H1 and H4, USDJPY H1, EURUSD H1, GBPUSD H1, NZDUSD H1, plus the share of bars in the same position, January 2020 to June 2026

  • Positions matched on 96–99.5% of bars between the two brokers' tick volume, and 96–98% with no volume at all.
  • Profit factor usually moved by less than 0.1, never by more than 0.2, and with no direction to it. Gold H4 was 1.60 with Exness volume and 1.79 with volume set to 1.
  • Turning the switch on (RSI instead of MFI) gave nearly the same results too: gold H1 1.20 instead of 1.22, H4 1.40 instead of 1.47.

The reason is simple once you see it. Over 14 bars, MFI above 50 mostly means hlc3 went up more than it went down. The volume weights shuffle that a little but rarely flip it. So pick either setting. Your broker's tick feed won't change your signals much.

What are the best AlphaTrend settings?

The defaults are fine, and the choice of timeframe matters far more than the numbers.

I ran 36 combinations: multiplier 0.5 to 3, period 7 to 50. On gold H1, all 36 had PF above 1, and 35 of 36 were profitable in both halves of 2020–2026. Gold M30 and H4: all 36 above 1. USDJPY H1: 35 of 36. On EURUSD, GBPUSD and NZDUSD almost nothing worked whatever I set. When every setting works on one market and none work on another, that's the market, not the setting.

The D1 numbers are the trap. Gold D1 PF 2.53 and USDJPY D1 1.82 look like the best cells in the table. They come from 51 and 44 trades. Flip the volume switch on gold D1 and PF drops to 1.29. I wouldn't pick a timeframe on that.

I also tried a standard RMA-smoothed ATR instead of the script's SMA, and moved the candle open by up to three hours. Neither changed the picture: gold H4 stayed between 1.41 and 1.61.

Is the gold result an edge or just gold going up?

Mostly gold going up. Three tests point the same way.

By year. Gold H4, long + short, USD per 0.01 lot:

Exness gold H4 2020 2021 2022 2023 2024 2025 2026 (to Sep)
Trades 31 44 42 40 45 36 27
PF 0.79 1.18 1.03 1.31 1.21 2.37 1.83
Net −140 +87 +21 +152 +144 +1,026 +1,044

89% of the profit came in 2025 and 2026. Trades before the author published version 2.0 (9 January 2023) made PF 0.97 on gold H4. After, 1.76.

Random timing. I slid the strategy's own long/short sequence to a random point in time, 200 times, keeping trade lengths. Gold beat 90–97% of the shifted copies depending on timeframe, and USDJPY H1 95.5%. That sounds good. But I tested 70 market/timeframe cells, and a few will look like that by chance. Nothing else came close.

Older data. This one settles it. Dukascopy gold, 2004 to 2019, with spread, commission and swap:

AlphaTrend on gold H4 from 2004 to 2026, gold price on a log scale above, cumulative percent per trade below for long only and long plus short, 2004 to 2019 shaded, Dukascopy M1 data with file spread, commission and long swap scaled to price

Profit factor 2004–2019 2020–2026
Gold H1, long + short 1.01 1.12
Gold H4, long + short 1.03 1.27
Gold H4, long only 1.23 1.78
USDJPY H1, long + short 0.98 1.14
EURUSD / GBPUSD / NZDUSD H1 0.95 / 1.01 / 0.98 0.96 / 0.89 / 0.86

Over those 16 years gold H4 long + short made +15% of price. Gold itself made +266%. Long only made +64%, and nearly all of it before 2012. After that, gold drifted down and sideways until 2019, and AlphaTrend gave some back.

What it costs to hold gold longs

Swap matters on a system that sits long for days. With Exness Raw long swap scaled to the gold price at the time, gold H4 drops from PF 1.47 to 1.38, H1 from 1.22 to 1.18. Long only on H4 goes from 2.08 to 1.85. About 17% of the profit goes to swap, and closer to 28% if you charge today's swap rate on every year.

Risk structure

  • No stop loss. A position only closes on the opposite signal. The line itself is the obvious place for a stop, but the script doesn't use it.
  • Win rate 39% on gold H4, 37% on H1. The longest losing streak on gold H4 was 7 trades.
  • The ten worst gold H4 trades (long + short, USD per 0.01 lot, before swap). Seven of them opened in 2026, when gold moved 100+ USD in a day:
Entry Exit Side Entry → exit price Loss Worst point against Held
9 Feb 2026 20:00 17 Feb 16:00 Buy 5,074.8 → 4,878.4 −196.4 233.6 188 h
19 Aug 2026 00:00 19 Aug 20:00 Sell 4,333.1 → 4,511.2 −178.2 194.6 20 h
17 Feb 2026 16:00 20 Feb 00:00 Sell 4,878.4 → 4,988.0 −109.6 144.0 56 h
18 Sep 2026 12:00 23 Sep 20:00 Buy 4,381.4 → 4,284.1 −97.4 106.8 128 h
29 May 2026 12:00 3 Jun 20:00 Buy 4,538.5 → 4,444.0 −94.5 114.7 128 h
2 Jul 2026 20:00 8 Jul 16:00 Buy 4,121.5 → 4,034.2 −87.3 99.8 140 h
27 May 2025 12:00 2 Jun 16:00 Sell 3,288.5 → 3,374.4 −86.0 93.9 148 h
29 Dec 2025 20:00 5 Jan 08:00 Sell 4,337.1 → 4,422.0 −85.0 103.0 156 h
3 Sep 2026 12:00 8 Sep 20:00 Buy 4,444.1 → 4,359.6 −84.6 98.8 128 h
2 Feb 2023 00:00 3 Feb 16:00 Buy 1,953.1 → 1,873.1 −80.1 91.7 40 h

At today's gold prices one bad H4 trade costs 100–200 USD per 0.01 lot. Size for that.

  • No martingale, no grid, no averaging down. One position at a time.

Who should use it?

If you trade gold, yen or indices and want a mechanical trend filter, AlphaTrend works as one. The line gives you a level to be wrong at, it doesn't repaint after the close, and the signal is nearly the same on any broker's feed. On H1 to H4, long side only, it stayed with gold's rise at a smaller drawdown than holding.

Don't run the strategy script as a two-way system on forex majors, and don't count on the short side. And don't pick D1 because of the PF in the table.

What I couldn't verify

  • TradingView's own report. My numbers come from my port, not TradingView's tester.
  • Forex swap. Not included for USDJPY or the other pairs.
  • Live fills. These are bar-open fills with real spread, not live execution. On H1 and H4 a few seconds of delay matters little, but I haven't measured it.
  • Markets outside these seven. I didn't test crypto other than Bitcoin, stocks, or exotic pairs.

Bottom line

The TradingView AlphaTrend strategy doesn't repaint after the close, and with default settings it lost on every forex major from M5 to H4. On gold, yen, the S&P and Bitcoin it made money, nearly all of it from the long side, and on gold about as much as holding. What it does well is ratchet in one direction while the trend holds, which makes it a trailing level and trend filter more than a strategy. Its MFI filter gives almost the same signals with or without volume.

This is part of a series where I port the most-boosted open-source TradingView strategies and test them on broker ticks with real costs. For one that held on 16 years of unseen gold data, see the Super Scalper backtest. For another Kıvanç Özbilgiç script with the same long-side pattern on gold, see the PMax backtest and the SuperTrend backtest.

I sell an MT4/MT5 port of the AlphaTrend indicator. I'm not affiliated with TradingView or KivancOzbilgic. Past results, including backtests, don't guarantee future results.