The system compares two past closes, one 28 bars back and one 207 bars back. If the recent one is higher, it buys and holds until that comparison flips. It is long only and sizes each trade from a fixed capital amount.
Best run of 31. Visa, Daily, from run stock2-queue:2026-09-15-Visa.tsv:13.
| Period | Up to 2026-09-15 |
| Instrument | Visa, 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 |
| recentLag Bars back to the recent reference close | 28 |
| distantLag Bars back to the distant reference close | 207 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| VisaBest run | Daily | 12.00 | 52 | 61.54 | 38,440 USD | -8,990 |
| Palantir | Daily | 111.46 | 13 | 76.92 | 79,699 USD | -50,083 |
| Meta | Daily | 13.28 | 19 | 52.63 | 79,285 USD | -16,771 |
| Broadcom | Daily | 10.25 | 62 | 51.61 | 75,723 USD | -16,715 |
| Amazon | Daily | 9.95 | 107 | 57.94 | 177,764 USD | -94,854 |
| Oracle | Daily | 9.77 | 149 | 57.72 | 257,341 USD | -78,792 |
| Tesla | Daily | 8.92 | 67 | 46.27 | 207,426 USD | -48,440 |
| Cisco | Daily | 8.54 | 108 | 45.37 | 179,574 USD | -45,603 |
| Microsoft | Daily | 8.12 | 114 | 46.49 | 169,311 USD | -40,856 |
| Apple | Daily | 7.88 | 91 | 54.95 | 175,138 USD | -40,091 |
| Nvidia | Daily | 6.78 | 70 | 47.14 | 149,329 USD | -57,284 |
| AbbVie | Daily | 6.48 | 47 | 68.09 | 16,154 USD | -6,527 |
| Mastercard | Daily | 6.42 | 59 | 54.24 | 51,965 USD | -16,760 |
| Walmart | Daily | 6.16 | 197 | 52.79 | 122,002 USD | -20,904 |
| Alphabet | Daily | 5.93 | 34 | 64.71 | 14,192 USD | -5,273 |
| Lam Research | Daily | 4.14 | 106 | 48.11 | 92,002 USD | -34,505 |
| ExxonMobil | Daily | 4.10 | 201 | 54.23 | 77,170 USD | -7,211 |
| Coca-Cola | Daily | 3.97 | 199 | 49.25 | 64,236 USD | -12,081 |
| Eli Lilly | Daily | 3.90 | 173 | 50.87 | 103,217 USD | -14,390 |
| S&P 500 | Daily | 3.27 | 174 | 55.17 | 43,109 EUR | -4,902 |
| Johnson & Johnson | Daily | 3.23 | 216 | 50.46 | 62,022 USD | -10,144 |
| Berkshire Hathaway | Daily | 2.94 | 104 | 44.23 | 27,076 USD | -7,719 |
| Costco | Daily | 2.82 | 140 | 51.43 | 47,827 USD | -12,266 |
| Bank of America | Daily | 2.45 | 92 | 55.43 | 30,060 USD | -15,712 |
| Applied Materials | Daily | 2.33 | 106 | 50.00 | 36,101 USD | -43,779 |
| Chevron | Daily | 2.26 | 153 | 54.90 | 25,356 USD | -5,342 |
| Caterpillar | Daily | 1.84 | 231 | 45.89 | 41,171 USD | -12,765 |
| AMD | Daily | 0.81 | 92 | 36.96 | -10,026 USD | -41,370 |
| Intel | Daily | 0.34 | 9 | 11.11 | -12,833 USD | -19,500 |
| JPMorgan | Daily | 0.20 | 43 | 25.58 | -10,192 USD | -10,310 |
| Micron | Daily | 0.12 | 8 | 25.00 | -10,992 USD | -15,567 |
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.
// ============================================================ // Twelve Minus Two Momentum // ProRealAlgos Strategy Library | prorealalgos.com // Type: Momentum // Direction: Long only // Timeframe tested: Daily // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- capitalPerTrade = 10000 // money committed to each trade recentLag = 28 // bars back to the recent reference close distantLag = 207 // bars back to the distant reference close // --- Indicators --- positionSize = capitalPerTrade / close momentumUp = close[recentLag] > close[distantLag] momentumDown = close[recentLag] < close[distantLag]
14 more lines: the entry and exit rules.
Read this first
Questions
Yes, it works on Daily bars and places market orders. The code is a rewrite without a compile check, and the stats are from the earlier version.
A set of large US stocks from Apple to Walmart, plus the S&P 500. Visa made USD 38,439.91 with a profit factor of 12.0, while AMD, Intel, JPMorgan and Micron ended negative.
Each trade commits 10000 USD, divided by the close to get the share count. Visa's max drawdown at that size was USD 8,990.42.
The rule looks back 207 bars, which on Daily bars covers most of a trading year. On faster bars the signal would lose that meaning.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.