Join today
Strategies / Trend / Long-Term Moving Average Cross

Long-Term Moving Average Cross on Daily Stock Charts

One rule in, one rule out: buy when the daily close crosses above the 200-day simple moving average, sell when it crosses back below. It stays in the market only while the long trend is up.

TrendLong onlySwingNvidiaDaily
12.31Profit factor
212,207Net profit USD
31.15%Win rate
61Trades
-23,612Max drawdown
3,479Avg trade

Best run of 31. Nvidia, Daily, from run stock2-queue:2026-09-15-NVIDIA.tsv:2.

Entry rules, long

  1. Members only

Exit rules

  1. Members only
  2. No stop loss or target

Test conditions

PeriodUp to 2026-09-15
InstrumentNvidia, Daily
Capital per trade10,000
CostsNot recorded for this run.
BarsDaily bars, full available history
Last tested2026-09-15

Parameters

capitalPerTrade
Money committed to each trade
10000
slowPeriod
Simple moving average length
200

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
NvidiaBest runDaily12.31 6131.15212,207 USD-23,612
PalantirDaily28.39 1315.38149,501 USD-54,790
MetaDaily8.94 3435.2949,332 USD-15,977
AppleDaily7.82 8535.29164,694 USD-33,412
AlphabetDaily5.61 4434.0926,622 USD-4,876
TeslaDaily5.07 8316.87110,713 USD-37,556
CiscoDaily5.06 8427.3881,884 USD-26,829
BroadcomDaily4.94 7819.2365,646 USD-14,139
Lam ResearchDaily3.92 10231.37107,464 USD-37,036
MicrosoftDaily3.84 15527.1086,944 USD-11,074
MastercardDaily3.72 6527.6937,226 USD-7,980
OracleDaily3.60 16431.1097,743 USD-20,025
MicronDaily3.38 14222.54130,167 USD-27,944
AMDDaily3.29 15021.33132,115 USD-28,065
VisaDaily3.24 7929.1127,900 USD-6,543
WalmartDaily3.07 21422.9073,998 USD-28,810
Applied MaterialsDaily2.90 11518.2662,019 USD-35,938
S&P 500Daily2.60 21323.0037,627 EUR-3,735
Eli LillyDaily2.59 23223.7160,258 USD-12,561
CostcoDaily2.53 16524.8540,509 USD-11,656
ExxonMobilDaily2.52 24026.6749,203 USD-5,805
Coca-ColaDaily2.37 24516.7344,426 USD-14,055
Johnson & JohnsonDaily2.36 23220.6943,047 USD-8,357
CaterpillarDaily2.23 21820.1847,516 USD-11,781
AbbVieDaily1.91 5928.818,896 USD-6,627
Berkshire HathawayDaily1.89 12120.6615,092 USD-5,130
Bank of AmericaDaily1.60 12028.3315,764 USD-10,918
JPMorganDaily1.59 25516.8633,526 USD-15,981
ChevronDaily1.02 20120.90772 USD-12,325
AmazonDaily0.07 1910.53-10,311 USD-12,814
IntelDaily0.00 20.00-10,000 USD-10,000

Charts

Results by run

Profit factor by run

Above 1.0 made money, below 1.0 lost money.

0.0132538501.0 = break-evenPalantir · Daily28.39Nvidia · Daily12.31Meta · Daily8.94Apple · Daily7.82Alphabet · Daily5.61Tesla · Daily5.07Cisco · Daily5.06Broadcom · Daily4.94Lam Research · Daily3.92Microsoft · Daily3.84Mastercard · Daily3.72Oracle · Daily3.60Micron · Daily3.38AMD · Daily3.29Visa · Daily3.24Walmart · Daily3.07Applied Materials · Daily2.90S&P 500 · Daily2.60Eli Lilly · Daily2.59Costco · Daily2.53ExxonMobil · Daily2.52Coca-Cola · Daily2.37Johnson & Johnson · Daily2.36Caterpillar · Daily2.23

Net profit against max drawdown

Net profitMax drawdown
0-100K-50K125K250KNvidia · DailyApple · DailyPalantir · DailyAMD · DailyMicron · DailyTesla · DailyLam Research · DailyOracle · DailyMicrosoft · DailyCisco · DailyWalmart · DailyBroadcom · DailyApplied Materials · DailyEli Lilly · DailyMeta · DailyExxonMobil · Daily

The code

ProBuilder, rewritten to house standard

Every file in the library uses the same header, the same section order and the same variable names. The numbers above were produced by the original version before the rewrite, and the rewrite has not yet been compiled in ProRealTime.

// ============================================================
// Long-Term Moving Average Cross
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Trend
// Direction: Long only
// Timeframe tested: Daily
// ============================================================

// --- Settings ---
DEFPARAM CumulateOrders = false

// --- Parameters ---
capitalPerTrade = 10000   // money committed to each trade
slowPeriod = 200          // simple moving average length

// --- Indicators ---
positionSize = capitalPerTrade / close
slowMA = Average[slowPeriod, 0](close)

13 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • With no stop loss, a trade can give back a lot before the close drops under the 200-day SMA. Palantir had a USD 54,789.51 drawdown.
  • Win rates are low, 31.15% on Nvidia and 15.38% on Palantir, so it lives on a handful of big trends and many small whipsaws.
  • Amazon ended at USD -10,310.50 and Intel at USD -10,000.00, so the rule does not work on every stock.
  • The top result on Nvidia comes from only 61 trades, and the stats are from the code before its rewrite.

Indicators used

SMA

How to load it

  1. Copy the code with the copy button above 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.

Questions

About this strategy

Can I run it as a ProOrder system?

Yes, it runs on daily bars and buys 10000 divided by the close for each trade. The code has not been compile checked since the rewrite.

Which stocks did it work on?

It was run on daily charts of large US stocks and the S&P 500, and most were profitable. Nvidia made USD 212,207.08 and Apple USD 164,693.80, while Amazon and Intel lost money.

What drawdown should I plan for?

At 10000 USD per trade the Nvidia run had a maximum drawdown of USD 23,612.35. Tesla reached USD 37,556.12.

Why the 200-day average?

It is a slow line that tracks the long term trend, so the system trades rarely and holds for months when a stock trends.

Related

Strategies like this one

Bollinger Squeeze

Uses the same indicator.

14.30 PF · 86 trades

Twelve Minus Two Momentum

A similar profit factor.

12.00 PF · 52 trades

Slow MACD Slope

Also a trend strategy.

6.80 PF · 7,305 trades

Prefer simple trend rules on stocks? Join the ProRealAlgos community 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