Join waitlist
Strategies / Trend / SMA Crossover With Trailing Stop

SMA Crossover With Trailing Stop

It buys when SMA(10) crosses above SMA(20) and sells short when it crosses below, reversing the position each time. Each trade carries a 10 percent trailing stop that only moves in its favor.

TrendLong & shortSwingSilver4 hours
3.58Profit factor
602,063Net profit USD
35.32%Win rate
1,730Trades
-18,973Max drawdown
348Avg trade

Best run of 6. Silver, 4 hours, spread 2, from run pf:2026-10-12-SILVER-4h.tsv:8.

Entry rules, long

  1. SMA(10) crosses over SMA(20).

Entry rules, short

  1. SMA(10) crosses under SMA(20).

Exit rules

  1. An opposite SMA cross reverses the position.

Test conditions

PeriodUp to 2026-10-12
InstrumentSilver, 4 hours
Spread2 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-12

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
SilverBest run4 hours3.58 1,73035.32602,063 USD-18,973
USD/JPYDaily1.63 70544.404,419,510 USD-373,520
USD/JPY1 hourn/a 7,72037.311,273,050 USD-572,180
EUR/USDDailyn/a 70139.37111,222 USD-80,242
GoldDailyn/a 76137.842,909 EUR-880
Gold1 hourn/a 6,80434.272,345 EUR-1,574

Charts

Results by run

Above 1.0 made money, below 1.0 lost money.

The code

ProBuilder code, as tested

// ==============================================================
// SMA Crossover With Trailing Stop
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long & short
// Timeframe tested: 4 hours
// ==============================================================

DEFPARAM CumulateOrders = false

fast = Average[10](close)
slow = Average[20](close)

11 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
  • Results include the spread only. Commissions and overnight financing are not included.
  • The code is published as it was backtested and has not been compiled again since.

Questions

About this strategy

Can I run SMA Crossover With Trailing Stop 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 6 market and timeframe combinations. The best run was Silver, 4 hours, with a profit factor of 3.58 over 1,730 trades.

How large was the drawdown?

The best run had a maximum drawdown of 18,973 USD at the tested position size, against a net result of 602,063 USD.

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

SMA Crossover With RSI Exit

Best run on the same market, Silver.

2.13 PF · 8,999 trades

EMA Crossover With Bollinger Stop

Also a trend strategy.

3.55 PF · 100 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