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.
Best run of 31. Nvidia, Daily, from run stock2-queue:2026-09-15-NVIDIA.tsv:2.
| Period | Up to 2026-09-15 |
| Instrument | Nvidia, Daily |
| Capital per trade | 10,000 |
| Costs | Not recorded for this run. |
| Bars | Daily bars, full available history |
| Last tested | 2026-09-15 |
| capitalPerTrade Money committed to each trade | 10000 |
| slowPeriod Simple moving average length | 200 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| NvidiaBest run | Daily | 12.31 | 61 | 31.15 | 212,207 USD | -23,612 |
| Palantir | Daily | 28.39 | 13 | 15.38 | 149,501 USD | -54,790 |
| Meta | Daily | 8.94 | 34 | 35.29 | 49,332 USD | -15,977 |
| Apple | Daily | 7.82 | 85 | 35.29 | 164,694 USD | -33,412 |
| Alphabet | Daily | 5.61 | 44 | 34.09 | 26,622 USD | -4,876 |
| Tesla | Daily | 5.07 | 83 | 16.87 | 110,713 USD | -37,556 |
| Cisco | Daily | 5.06 | 84 | 27.38 | 81,884 USD | -26,829 |
| Broadcom | Daily | 4.94 | 78 | 19.23 | 65,646 USD | -14,139 |
| Lam Research | Daily | 3.92 | 102 | 31.37 | 107,464 USD | -37,036 |
| Microsoft | Daily | 3.84 | 155 | 27.10 | 86,944 USD | -11,074 |
| Mastercard | Daily | 3.72 | 65 | 27.69 | 37,226 USD | -7,980 |
| Oracle | Daily | 3.60 | 164 | 31.10 | 97,743 USD | -20,025 |
| Micron | Daily | 3.38 | 142 | 22.54 | 130,167 USD | -27,944 |
| AMD | Daily | 3.29 | 150 | 21.33 | 132,115 USD | -28,065 |
| Visa | Daily | 3.24 | 79 | 29.11 | 27,900 USD | -6,543 |
| Walmart | Daily | 3.07 | 214 | 22.90 | 73,998 USD | -28,810 |
| Applied Materials | Daily | 2.90 | 115 | 18.26 | 62,019 USD | -35,938 |
| S&P 500 | Daily | 2.60 | 213 | 23.00 | 37,627 EUR | -3,735 |
| Eli Lilly | Daily | 2.59 | 232 | 23.71 | 60,258 USD | -12,561 |
| Costco | Daily | 2.53 | 165 | 24.85 | 40,509 USD | -11,656 |
| ExxonMobil | Daily | 2.52 | 240 | 26.67 | 49,203 USD | -5,805 |
| Coca-Cola | Daily | 2.37 | 245 | 16.73 | 44,426 USD | -14,055 |
| Johnson & Johnson | Daily | 2.36 | 232 | 20.69 | 43,047 USD | -8,357 |
| Caterpillar | Daily | 2.23 | 218 | 20.18 | 47,516 USD | -11,781 |
| AbbVie | Daily | 1.91 | 59 | 28.81 | 8,896 USD | -6,627 |
| Berkshire Hathaway | Daily | 1.89 | 121 | 20.66 | 15,092 USD | -5,130 |
| Bank of America | Daily | 1.60 | 120 | 28.33 | 15,764 USD | -10,918 |
| JPMorgan | Daily | 1.59 | 255 | 16.86 | 33,526 USD | -15,981 |
| Chevron | Daily | 1.02 | 201 | 20.90 | 772 USD | -12,325 |
| Amazon | Daily | 0.07 | 19 | 10.53 | -10,311 USD | -12,814 |
| Intel | Daily | 0.00 | 2 | 0.00 | -10,000 USD | -10,000 |
Charts
Above 1.0 made money, below 1.0 lost money.
The code
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
Questions
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.
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.
At 10000 USD per trade the Nvidia run had a maximum drawdown of USD 23,612.35. Tesla reached USD 37,556.12.
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
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.