Join waitlist
Strategies / Pattern / Three Candle Moving Average Pattern

Three Candle Moving Average Pattern

Buys after a green, red, green candle sequence where all prices sit above the current highest of the 20, 40 and 80 period averages, with the 20 period average above the other two. Closes the long when a bar's range spans the 80 period average.

PatternLong onlySwingGold4 hours
2.09Profit factor
2,802Net profit EUR
40.00%Win rate
225Trades
-646Max drawdown
12.45Avg trade

Best run of 37. Gold, 4 hours, spread 0.6, from run pf:2026-10-04-GOLD-4h.tsv:9.

Entry rules, long

  1. Open, high, low and close of the last three bars are all above the current highest of the 20, 40 and 80 period averages.
  2. The 20 period average is above both the 40 and 80 period averages.

Exit rules

  1. A bar whose low is below and whose high is above the 80 period average closes the long.

Test conditions

PeriodUp to 2026-10-04
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-04

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
GoldBest run4 hours2.09 22540.002,802 EUR-646
Nikkei 2251 hour1.36 68234.6027,656 USD-6,082
DAX 401 hour1.28 84936.5111,012 EUR-2,670
Nasdaq 10015 min1.20 1,47634.6910,026 EUR-2,467
USD/JPYDailyn/a 9537.89966,770 USD-349,850
USD/JPY1 hourn/a 99834.77476,380 USD-270,910
USD/JPY30 minn/a 1,38635.86450,280 USD-175,640
USD/JPY15 minn/a 1,43732.99275,530 USD-122,970
USD/JPY10 minn/a 1,48932.57247,860 USD-108,500
EUR/USDDailyn/a 8840.9133,167 USD-27,990
Nikkei 22530 minn/a 1,31834.1423,056 USD-8,095
Nasdaq 100Dailyn/a 9445.7414,464 EUR-2,429
Silver1 hourn/a 83030.7214,321 USD-14,303
Dow Jones1 hourn/a 29938.4610,693 EUR-7,937
Nikkei 22515 minn/a 1,35932.1610,530 USD-8,405
Brent CrudeDailyn/a 3636.119,366 EUR-4,531
Nasdaq 1001 hourn/a 94434.538,944 EUR-3,134
Nasdaq 10010 minn/a 1,43634.687,283 EUR-4,296
DAX 40Dailyn/a 8141.986,990 EUR-4,207
US Crude OilDailyn/a 9432.986,504 EUR-4,694
DAX 4030 minn/a 1,43832.825,562 EUR-3,096
Nasdaq 1004 hoursn/a 26937.925,134 EUR-4,061
Brent Crude1 hourn/a 46436.215,052 EUR-4,270
Nasdaq 1005 minn/a 1,46732.994,368 EUR-2,753
DAX 4015 minn/a 1,50232.623,938 EUR-3,194
Gold1 hourn/a 84437.912,698 EUR-698
GoldDailyn/a 9338.712,305 EUR-929
S&P 500Dailyn/a 12040.002,209 EUR-737
Gold30 minn/a 1,31432.271,535 EUR-573
Gold15 minn/a 1,37831.351,430 EUR-660
S&P 5004 hoursn/a 26542.261,429 EUR-507
Gold5 minn/a 1,42630.791,083 EUR-388
S&P 50030 minn/a 1,33934.801,048 EUR-1,030
S&P 5001 hourn/a 93735.54941 EUR-572
Gold10 minn/a 1,37630.89910 EUR-523
Gold3 minn/a 1,35929.80660 EUR-563
Gold2 minn/a 1,33629.79632 EUR-447

Charts

Results by run

Top 10 of 37 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

// ==============================================================
// Three Candle Moving Average Pattern
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Pattern
// Direction: Long only
// Timeframe tested: 4 hours
// ==============================================================

DEFPARAM CumulateOrders = false

smaa = Average[20](close)
smab = Average[40](close)
smac = Average[80](close)
top = max(max(smaa, smab), smac)

above = 0

20 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

SMA
Longer historyRe-run on up to 1,000,000 barsGold · 4 hours · older data 0.00 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 run2,802.30 EUR
Net, long run2,802.30 EUR
Net on the older data alone0.00 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 Three Candle Moving Average Pattern 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 37 market and timeframe combinations. The best run was Gold, 4 hours, with a profit factor of 2.09 over 225 trades.

How large was the drawdown?

The best run had a maximum drawdown of 646 EUR at the tested position size, against a net result of 2,802 EUR.

Does it trade long, short or both?

It only takes long trades.

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

Doji Sweep With RSI Divergence

Also a pattern strategy.

2.07 PF · 114 trades

Get the full rules, the complete code and the ProRealAlgos portfolio as a member.

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