TradingView PMax Strategy: Best Settings, Repaint, Backtest
The short version. This is a TradingView PMax strategy backtest, with the settings and repaint questions answered along the way. The script is PMax Explorer STRATEGY & SCREENER by KivancOzbilgic, the fourth most-boosted open-source strategy on TradingView. I ported it line for line to Python and ran it on 6.7 years of real Exness ticks, with real spreads and commission.
- Gold H1 is the one result that holds up. Profit factor 1.37 on 448 trades, Jan 2020 to Sep 2026. It survives shifted candle times and all 56 settings I tried. After swap on a Raw account it drops to 1.26.
- It still mostly rode the gold rally. From 2020 to 2022 it had a small real edge: longs and shorts both made money while gold went nowhere. Since 2024, almost all of the profit has come from the long side.
- Forex is break-even at best. NZDUSD lost on every timeframe. EURUSD and GBPUSD hover around a profit factor of 1.0, depending on the years you look at.
My verdict: it's a better trend filter than SuperTrend on most of the markets I tested. It's still not a robot you can switch on and forget.
What is the PMax strategy on TradingView?
PMax ("Profit Maximizer") is SuperTrend with one change: the ATR bands hang off a moving average instead of off price. The PMax Explorer script is under the Mozilla Public License, its current version dates from June 2021, and it had 17,119 boosts when I checked on 9 October 2026.
Here are the rules with the default settings. Take a 10-period EMA of the bar midpoint (high plus low, divided by two). Draw a stop line 3 × ATR(10) below it and another 3 × ATR(10) above it. Each line only moves in the trend's favour. The strategy goes long when the EMA crosses above the active line and short when it crosses below.
It's always in the market. There's no stop loss and no take profit. The opposite signal closes the trade and flips it. Here's the core of the Pine code, © KivancOzbilgic:
longStop = MAvg - Multiplier*atr
longStopPrev = nz(longStop[1], longStop)
longStop := MAvg > longStopPrev ? max(longStop, longStopPrev) : longStop
shortStop = MAvg + Multiplier*atr
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := MAvg < shortStopPrev ? min(shortStop, shortStopPrev) : shortStop
dir := dir == -1 and MAvg > shortStopPrev ? 1 : dir == 1 and MAvg < longStopPrev ? -1 : dir
PMax = dir==1 ? longStop: shortStop
So the difference from SuperTrend is small but real. SuperTrend flips when a candle closes through the line. PMax flips when the moving average crosses it. A single spiky candle can't flip PMax, but every flip comes a little later.
The "Explorer" and "Screener" part of the name is a label that lists which of 20 symbols are trending up or down. It doesn't affect the trades, so I didn't test it.
Does PMax repaint?
No, not the strategy. Signals use closed bars and fill at the next bar's open. What you see on a historical chart is what you'd have got at the time, before costs. The screener's "Potential Reversal" list can change while a bar is still open, and the author says so on the page.
What does the author claim?
The description makes more claims than the SuperTrend page did, so this review is mostly a checklist.
| Claim in the description | What I found |
|---|---|
| "Backtest and optimization results of PMax are far better" than MOST and SuperTrend | Better than SuperTrend in 7 of 10 H1/H4 tests, much worse on gold H4. I didn't test MOST |
| "Reduces the number of false signals in sideways" markets | It trades about half as often as SuperTrend. On EURUSD, GBPUSD and NZDUSD it still loses money or barely breaks even |
| "Can be used in any type of markets and instruments" | Gold H1 works. On NZDUSD, none of 112 settings made money in both 2020–2022 and 2023–2026 |
| "It does not repaint" | True for the strategy |
| Moving average length and type are "the most important" settings | Length matters less than you'd think on gold, and no MA type wins across markets |
| "In sideways VAR would be a good choice" | Mixed. It helps on two forex H4 tests and hurts on gold H4 and EURUSD H1 |
How I tested it
- Port: I rewrote the trading logic in Python, keeping Pine's
nz()and cross rules. Over 6.7 years of gold H4 bars, the 135 signals matched the 135 trend flips exactly, and buys and sells alternated every time. - Data: Exness Raw Spread tick archives for XAUUSD, USDJPY, EURUSD, GBPUSD and NZDUSD. Gold starts on 29 January 2020, where the archive starts. Everything runs to September 2026.
- Costs: longs fill at the real ask and shorts at the real bid. I added 3.5 USD per lot per side for commission. Swap is in its own section, because it changes the gold numbers a lot.
- Runs: M15, H1, H4 and D1, each with and without costs. On top of that I shifted the candle times, swept 56 settings, tried all eight MA types and tested the second entry method. That's around 800 backtests.
- Units: fixed size, no compounding. Gold is in USD per 0.01 lot (one ounce). Forex is in pips.
Is the TradingView backtest accurate?
It gets the signals right and the money too rosy, for the reasons I went through in the SuperTrend backtest: no commission in the script, no spread or swap setting in TradingView. PMax trades half as often, so the gap is smaller.
| Test | Trades | PF, no costs | PF, real costs | Net, no costs → real |
|---|---|---|---|---|
| Gold M15 | 1,761 | 1.23 | 1.21 | +3,489 → +3,219 USD |
| Gold H1 | 448 | 1.38 | 1.37 | +2,706 → +2,638 USD |
| USDJPY M15 | 1,912 | 1.06 | 1.02 | +2,939 → +805 pips |
| GBPUSD M15 | 2,005 | 0.99 | 0.95 | −330 → −2,093 pips |
| NZDUSD M15 | 2,057 | 0.99 | 0.91 | −266 → −2,706 pips |
On forex M15, costs turn a near-zero result into a clear loss. On gold H1 they hardly register.
The results
Gold (XAUUSD Raw Spread), 29 Jan 2020 – Sep 2026, default settings, after spread and commission:
| Timeframe | Trades | Win rate | PF before swap | Net before swap | PF after swap | Net after swap | Max drawdown |
|---|---|---|---|---|---|---|---|
| M15 | 1,761 | 36.7% | 1.21 | +3,219 | 1.17 | +2,565 | 1,243 |
| H1 | 448 | 40.8% | 1.37 | +2,638 | 1.26 | +1,935 | 1,321 |
| H4 | 135 | 34.8% | 0.98 | −75 | 0.84 | −815 | 1,740 |
| D1 | 23 | 34.8% | 1.68 | +1,089 | 1.19 | +331 | 1,468 |
| Buy and hold | 1 | +2,587 | 1,527 |
Net and drawdown in USD per 0.01 lot. Drawdown is on open equity, before swap. Swap: −53.33 USD per lot per night on longs, shorts 0, triple on Wednesdays.

Forex, Raw Spread, Jan 2020 – Sep 2026, same settings, profit factor / net pips:
| M15 | H1 | H4 | D1 | |
|---|---|---|---|---|
| USDJPY | 1.02 / +805 | 1.04 / +1,034 | 1.34 / +3,756 | 1.02 / +134 |
| EURUSD | 0.90 / −3,647 | 1.09 / +1,321 | 1.06 / +493 | 0.94 / −227 |
| GBPUSD | 0.95 / −2,093 | 1.03 / +669 | 1.14 / +1,403 | 1.48 / +1,564 |
| NZDUSD | 0.91 / −2,706 | 0.85 / −2,163 | 0.83 / −1,386 | 0.35 / −2,314 |
Swap not included for forex. D1 has only 25 to 31 trades per pair, which is too few to mean much.
Is the gold H1 result real?
Partly. It passed every stress test I threw at it, but most of its money comes from one move.
What it passed:
- Shifted candles. I cut the H1 bars at :15, :30 and :45 past the hour instead of on the hour. The profit factor stayed between 1.24 and 1.37.
- It isn't a few lucky trades. The five biggest winners made +2,109 USD. The other 443 trades still made +528. On SuperTrend H1, the trades outside the top five lost money.
- Every setting works. All 56 combinations in the grid below made money.
Now split it by period:
| Gold H1 | Trades | PF | Longs | Shorts | Gold itself |
|---|---|---|---|---|---|
| 2020–2022 | 194 | 1.37 | +468 | +205 | +235 |
| 2023 | 77 | 0.95 | +88 | −127 | +239 |
| 2024–Sep 2026 | 177 | 1.44 | +2,057 | −53 | +2,093 |
In 2020–2022, gold went from about 1,589 to 1,824 and PMax made almost three times that, with both sides profitable. That's a small edge that doesn't depend on gold going up. After 2023, the short side stopped working, and the result became a slightly smoother way of holding gold.
What are the best PMax settings?
There isn't a magic one. On gold H1, all 56 settings I tried made money, so the default (EMA 10, ATR 10 × 3) is as good a choice as any. On NZDUSD, none of them made money in both halves of the test. The market matters far more than the dials.
One backtest with the default settings can look good or bad by accident. So I ran a grid of settings around the default to see whether the result holds when you move the dials. I wasn't looking for the best combination.
How I ran the sweep:
- Two dials, the ones the author says matter. ATR multiplier: 1, 1.5, 2, 2.5, 3, 3.5, 4 and 5. EMA length: 5, 8, 10, 15, 20, 30 and 50. That's 56 combinations. The ATR period stayed at 10 and the MA stayed EMA.
- Ten markets × timeframes. All five symbols, each on H1 and H4. That's 560 backtests.
- Same conditions as the main test. Real spread, commission, no swap, signals at bar close, fills at the next open.
- Two scores per combination. The first is the profit factor over the full period. The second, which matters more, is whether the combination made money in both halves: 2020–2022 and 2023–Sep 2026. A setting that only works in one half has probably just caught one big move.
I didn't pick a winner from the grid. Every headline number in this post uses the defaults: EMA 10, ATR 10 × 3.
What came out:
| Market | Combos with PF > 1 | PF > 1.2 | Profitable in both halves | Median PF | Default PF |
|---|---|---|---|---|---|
| XAUUSD H1 | 56 / 56 | 44 | 46 | 1.29 | 1.37 |
| XAUUSD H4 | 38 | 26 | 20 | 1.18 | 0.98 |
| USDJPY H1 | 50 | 2 | 34 | 1.09 | 1.04 |
| USDJPY H4 | 45 | 35 | 26 | 1.34 | 1.34 |
| EURUSD H1 | 30 | 0 | 10 | 1.01 | 1.09 |
| EURUSD H4 | 47 | 10 | 13 | 1.09 | 1.06 |
| GBPUSD H1 | 22 | 0 | 7 | 0.96 | 1.03 |
| GBPUSD H4 | 28 | 9 | 13 | 1.00 | 1.14 |
| NZDUSD H1 | 0 | 0 | 0 | 0.85 | 0.85 |
| NZDUSD H4 | 22 | 4 | 0 | 0.91 | 0.83 |
56 combinations per row. Trade counts run from about 160 (wide settings) to 1,800 (tight settings) on H1, and from 33 to 490 on H4.
- Gold H1 is the one result that doesn't depend on the settings. All 56 made money, 46 of them in both halves, and the worst had a profit factor of 1.03. The default isn't sitting on a lucky peak. Its 1.37 is close to the middle of the grid.
- NZDUSD is the opposite. On H1, nothing made money. On H4, some settings made money over the full period, but none in both halves. No setting fixes PMax on this pair.
- EURUSD and GBPUSD hover around break-even. Medians run from 0.96 to 1.09, and only 7 to 13 combinations held up in both halves. That's noise.
- USDJPY H4 has a high median (1.34), but only 26 of 56 combinations held up in both halves. The profit is the yen's slide in 2022 and 2024. In 2025 and 2026 the default lost 1,844 pips.

Why I don't quote the best cell. Every grid has one. Here's what it looked like in each half:
| Market | Best combination | PF, full period | PF, 2020–2022 | PF, 2023–2026 |
|---|---|---|---|---|
| XAUUSD H4 | ATR × 4, EMA 50 | 3.46 | 1.13 | 6.32 |
| XAUUSD H1 | ATR × 5, EMA 10 | 1.72 | 0.98 | 2.34 |
| NZDUSD H4 | ATR × 5, EMA 10 | 1.32 | 2.53 | 0.79 |
On gold, the top cell is the one that rode the 2024–2026 rally hardest. Before the rally it was flat. NZDUSD went the other way: great until 2022, losing after. If you'd optimised on the first half, you'd have picked a setting that failed in the second.
This sweep isn't an optimisation with a separate out-of-sample test, and it can't tell you which setting will work next year. It only shows whether a market gives PMax a chance across many settings. Gold H1 does. NZDUSD doesn't. The rest is a coin flip after costs.
Does the author's advice hold up?
Which moving average is best for PMax? None of them across the board. I ran all eight types on H1 and H4 for all five symbols:
| MA type | Tests with PF > 1 (of 10) | Gold H1 | Gold H4 | NZDUSD H4 | Gold H1 trades |
|---|---|---|---|---|---|
| EMA (default) | 7 | 1.37 | 0.98 | 0.83 | 448 |
| WMA | 7 | 1.25 | 1.02 | 0.86 | 532 |
| SMA | 6 | 1.32 | 1.07 | 0.95 | 488 |
| VAR | 6 | 1.28 | 0.93 | 1.05 | 337 |
| WWMA | 6 | 1.23 | 0.97 | 1.17 | 347 |
| TMA | 5 | 1.25 | 0.92 | 0.91 | 534 |
| ZLEMA | 5 | 1.16 | 1.58 | 0.84 | 897 |
| TSF | 4 | 1.10 | 1.35 | 0.79 | 1,127 |
The default EMA is as good as any. VAR, which the author suggests for sideways markets, trades the least. It rescued NZDUSD H4 (0.83 to 1.05) and helped GBPUSD H4 (1.20), but it was worse on gold H4 and EURUSD H1. And look at the gold H4 column. The same strategy goes from 0.92 to 1.58 just by changing the MA type. A result that sensitive is mostly noise.
What about buying when price crosses PMax? The description offers this as a second way to trade it. It roughly triples the number of trades, and the profit factor was lower than the default in 14 of 20 tests. Gold H4 (1.45) and D1 (2.93, only 49 trades) were the exceptions.
Is PMax better than SuperTrend? On most of what I tested, yes:

PMax had the higher profit factor in 7 of 10 H1/H4 tests, with roughly half the trades. The big exception is gold H4, where SuperTrend made 1.90 and PMax 0.98. So "far better" is too strong. It's usually a bit better and sometimes a lot worse.
Where does it break?

Mostly on forex after 2022. In 2023–2026 every forex H1 test was below 1.0 (0.93 to 0.96), and on H4 only GBPUSD (1.12) and USDJPY (1.01) stayed above it. Add gold H4, which broke even before swap and lost 815 USD per 0.01 lot after it, and the gold short side since 2023.
Risk structure
- No stop loss. A trade only ends when the opposite signal fires. The worst gold H1 trade lost 219 USD per 0.01 lot: a short from 4,599 on 2 April 2026, closed at 4,818 six days later.
- All ten of the worst gold H1 trades happened between October 2025 and August 2026, when gold traded between 4,000 and 5,200. A fixed lot risks more as the price and its swings grow. Size by ATR or by percent risk if you run it.
- Long holds and swap. Gold H1 trades last 5.4 days on average (longest 30), H4 18 days, D1 104 days. On a Raw account, swap took 703 USD of the 2,638 on gold H1. On an account with zero swap on gold, the before-swap column is the one that applies.
- Drawdown in money. On gold H1 the worst drawdown was 1,321 USD per 0.01 lot on open equity. That's 13% of a 10,000 USD account at 0.01 lot, and more than the whole account at 0.1 lot.
- What isn't a red flag: no martingale, no grid, no averaging down. A 34–41% win rate is normal for trend following, and so are losing streaks of 10 (gold H1) and 13 (NZDUSD H1).
Who should use it?
If you trade gold on H1 and want one line that tells you which side of the market to be on, PMax is a reasonable choice, and it held up better than SuperTrend there. I'd use it as a filter for another entry, or as an exit line. I wouldn't run it on its own on forex. And if you do run it on its own on gold, check your account's swap first, because on a Raw account it takes about a quarter of the profit.
What I couldn't verify
- MOST. The author compares PMax with MOST and SuperTrend. I've only tested SuperTrend.
- Forex swap. It isn't in the forex numbers. On USDJPY longs it may even have helped.
- The screener. Its trend function is written differently from the strategy's. I haven't checked whether its 20-symbol list matches what the strategy itself would do.
- TradingView itself. The "no costs" figures come from my port with the script's default settings, not from TradingView's tester.
- Slippage and other brokers. Orders fill on the first tick of the next bar. I only used Exness data.
- Daily candles. Mine close at UTC midnight. TradingView's forex daily bars usually close at 17:00 New York.
Bottom line
On gold H1, the TradingView PMax strategy beat SuperTrend and held up across every setting, with a small real edge in 2020–2022 and mostly rally profit after that. On forex it was break-even at best. It's a good trend filter and a weak robot.
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. If you want to see what changing the exits does to a trend strategy like this, SuperTrend part 2 keeps the entries and swaps the trade management on gold H4.
I'm not affiliated with TradingView or with KivancOzbilgic. 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.