Join waitlist
Strategies / Trend / Close Above SMA Long

Close Above SMA Long

The strategy buys when the close crosses above its 20-bar SMA, or above its 60-bar SMA if no 20-bar cross occurs. It holds a single long position and closes when the close crosses back below the average that opened the trade.

TrendLong onlySwingDAX 404 hours
1.21Profit factor
16,055Net profit EUR
27.29%Win rate
1,693Trades
-3,871Max drawdown
9.48Avg trade

Best run of 12. DAX 40, 4 hours, spread 3, from run pf:2026-10-12-DAX40-4h.tsv:8.

Entry rules, long

  1. If the close does not cross above the 20-bar SMA on that bar, a cross above the 60-bar SMA buys 1 contract.

Exit rules

  1. A long opened from the 60-bar SMA closes when the close crosses below that SMA.

Test conditions

PeriodUp to 2026-10-13
InstrumentDAX 40, 4 hours
Spread3 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-13

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
DAX 40Best run4 hours1.21 1,69327.2916,055 EUR-3,871
USD/JPYDailyn/a 80024.50783,720 USD-536,750
Nikkei 225Dailyn/a 67128.4632,050 USD-17,417
Dow JonesDailyn/a 86729.3021,073 EUR-6,050
Nikkei 2254 hoursn/a 1,55026.3215,539 USD-10,249
Dow Jones4 hoursn/a 58627.999,416 EUR-7,564
Nasdaq 1004 hoursn/a 1,68028.458,873 EUR-4,837
Nasdaq 100Dailyn/a 63429.188,471 EUR-6,372
DAX 40Dailyn/a 83929.328,178 EUR-4,492
S&P 500Dailyn/a 83627.873,251 EUR-1,023
GoldDailyn/a 79026.461,955 EUR-1,950
Gold4 hoursn/a 1,79925.241,642 EUR-1,628

Charts

Results by run

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

Net profitMax drawdown

The code

ProBuilder code, as tested

// ==============================================================
// Close Above SMA Long
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long only
// Timeframe tested: 4 hours
// ==============================================================

DEFPARAM CumulateOrders = false

ONCE leg = 0

smaa = Average[20](close)
smab = Average[60](close)

19 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
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 Close Above SMA Long 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 12 market and timeframe combinations. The best run was DAX 40, 4 hours, with a profit factor of 1.21 over 1,693 trades.

How large was the drawdown?

The best run had a maximum drawdown of 3,871 EUR at the tested position size, against a net result of 16,055 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

Heikin Ashi Color Flip

Best run on the same market, DAX 40.

1.12 PF · 3,692 trades

KAMA SMA Cross

Also a trend strategy.

1.21 PF · 548 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