Join waitlist
Strategies / Trend / Supertrend Flip With SMA Filter

Supertrend Flip With SMA Filter

The system follows a Supertrend on median price, 3.0 times ATR. It buys when the trend flips up with close above the 200-period average, and sells short when it flips down with close at or below that average.

TrendLong & shortSwingGold4 hours
1.77Profit factor
3,584Net profit EUR
41.71%Win rate
422Trades
-452Max drawdown
8.49Avg trade

Best run of 22. Gold, 4 hours, spread 0.6, from run pf:2026-10-05-GOLD-4h.tsv:8.

Entry rules, long

Entry rules, short

Exit rules

  1. A trend flip that fails the average filter closes the open position.

Test conditions

PeriodUp to 2026-10-05
InstrumentGold, 4 hours
Spread0.6 points
Starting capital1,000,000
CostsSpread only. Commissions and overnight financing are not included.
BarsUp to 200,000 bars, fewer where the instrument has less history
Last tested2026-10-05

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run4 hours1.77 42241.713,584 EUR-452
EUR/USDDaily1.66 18544.86141,203 USD-26,552
USD/JPYDailyn/a 20040.001,554,640 USD-435,330
USD/JPY1 hourn/a 1,75638.44519,360 USD-234,300
USD/JPY30 minn/a 2,51336.69281,240 USD-173,770
USD/JPY15 minn/a 2,65236.43164,040 USD-157,530
EUR/USD4 hoursn/a 62839.3363,611 USD-32,271
Nikkei 225Dailyn/a 18541.0839,525 USD-11,465
Nasdaq 100Dailyn/a 18240.1114,484 EUR-3,855
Dow JonesDailyn/a 19641.8411,940 EUR-11,349
Dow Jones4 hoursn/a 13940.2910,043 EUR-5,359
GBP/USDDailyn/a 21342.259,593 USD-8,749
US Crude Oil1 hourn/a 1,23638.358,586 EUR-4,960
GBP/USD1 hourn/a 2,19938.745,734 USD-5,250
Brent Crude1 hourn/a 90738.925,500 EUR-5,165
Gold30 minn/a 2,59735.812,934 EUR-933
GoldDailyn/a 19947.742,560 EUR-850
Gold1 hourn/a 1,52538.431,874 EUR-903
S&P 500Dailyn/a 24039.581,873 EUR-861
Gold5 minn/a 2,69534.031,736 EUR-558
Gold10 minn/a 2,65634.261,055 EUR-879
Gold2 minn/a 2,55733.201,007 EUR-616

Charts

Results by run

Top 10 of 22 runs. The full list is in the table above.

Above 1.0 made money, below 1.0 lost money.

The code

ProBuilder code, as tested

// ==============================================================
// Supertrend Flip With SMA Filter
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 4 hours
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE up = 0
ONCE dn = 0
ONCE trend = 1

myAtr = AverageTrueRange[10](close)
upraw = MedianPrice - 3.0 * myAtr
dnraw = MedianPrice + 3.0 * myAtr
upone = up
dnone = dn
IF BarIndex = 0 THEN
    upone = upraw
    dnone = dnraw
ENDIF

38 more lines: the entry and exit rules.

Setup

How to load it

  1. Copy the code with the copy button on the code block.
  2. In ProRealTime, open a chart of the instrument and timeframe you want to test, then open ProOrder > New trading system and choose "Create with programming".
  3. Paste the code, give the system a name and save it.
  4. Click "Backtest", set your own spread and position size, and run it before you consider trading it live.

Indicators used

SuperTrendATRSMA
Longer historyRe-run on up to 1,000,000 barsGold · 4 hours · older data 15.50 EUR

Gold had no history beyond the standard run, so both runs used 30,000 bars.

Gold · 4 hours

Bars available30,000
Net, standard 200,000-bar run3,584.30 EUR
Net, long run3,599.80 EUR
Net on the older data alone15.50 EUR
Read this firstKnown weaknesses2 points
  • The code sets no stop loss, so a losing trade stays open until an exit signal arrives.
  • Results include the spread only. Commissions and overnight financing are not included.

Questions

About this strategy

Can I run Supertrend Flip With SMA Filter in ProOrder?

Yes. The code is ProBuilder and runs as an automated ProOrder system. Backtest it on your own account with your own spread and position size before trading it live.

Which markets was it tested on?

It was tested on 22 market and timeframe combinations. The best run was Gold, 4 hours, with a profit factor of 1.77 over 422 trades.

How large was the drawdown?

The best run had a maximum drawdown of 452 EUR at the tested position size, against a net result of 3,584 EUR.

Does it trade long, short or both?

It trades both long and short.

Related

Strategies like this one

Trend Surfer

Uses the same indicator.

1.04 PF · 10,813 trades

CCI Breakout

Best run on the same market, Gold.

1.08 PF · 6,065 trades

RSI Pullback Trend Bracket

Also a trend strategy.

1.77 PF · 145 trades

Want strategies that are already part of a live portfolio? Join the ProRealAlgos waitlist.

The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.

Past backtest results do not guarantee future results. This is not financial advice. Curated and maintained by ProRealAlgos. ProRealTime™ is a trademark of ProRealTime SAS. prorealalgos.comStatsDocs