LongTermTrend_V0547
ARCHIVEDhybridllmAdded regime gates to restrict entries to uptrends and non-bubble regimes; simplified and consolidated entry logic to robust trend+momentum signals (200/50 SMA regime, 20d return or MACD, proximity to SMA50, breakout/volume OR price crossing SMA50) and added filters for RSI, 1y cumulative return and volatility percentile to reduce overfitting. Improved exit to include MACD sign, a hard drawdown stop, and price dropping below SMA50. Added volatility-based position sizing (reduce size in high vol). Reduced base position to 0.8 to lower turnover and risk.
Lineage
entry = LongTermTrend_V0235 OR MACDMomentum_V0272
Strategy Logic (pseudocode)
# LongTermTrend_V0547 [hybrid]
require regime.volatility in ['LOW_VOLATILITY', 'MEDIUM_VOLATILITY']
if flat and ((close > sma_200 or sma_50 > sma_200) and (ret_20d > 0.04 or macd_hist > 0.0) and dist_sma_50 > -0.1 and ((breakout_50 == 1 and rel_volume > 1.3) or close > sma_50) and rsi_14 < 75.0 and cumret_252d > -0.25 and vol_pctile < 0.85):
position = 0.8
if long and (macd_hist < 0.0 or drawdown < -0.12 or close < sma_50):
position = 0.0 # exit to cashBacktest Metrics
| Metric | Train | Validation | Hidden Test | Full |
|---|---|---|---|---|
| CAGR | -3.9% | 29.3% | -14.6% | -0.7% |
| Total Return | -27.4% | 116.0% | -44.2% | -10.4% |
| Sharpe | -0.18 | 1.24 | -0.98 | 0.04 |
| Sortino | -0.12 | 1.21 | -0.60 | 0.03 |
| Calmar | -0.09 | 0.97 | -0.30 | -0.01 |
| Volatility | 15.8% | 22.8% | 14.9% | 17.3% |
| Max DD | -42.9% | -30.2% | -47.9% | -61.0% |
| Win Rate | 41.0% | 50.6% | 38.0% | 42.5% |
| Avg Win | 2.3% | 4.0% | 1.9% | 2.8% |
| Avg Loss | -2.0% | -1.8% | -2.1% | -2.0% |
| Payoff | 1.18 | 2.24 | 0.90 | 1.44 |
| Expectancy | -0.2% | 1.1% | -0.6% | 0.1% |
| Profit Factor | 0.82 | 2.29 | 0.55 | 1.06 |
| Trades | 166 | 81 | 92 | 339 |
| Avg Holding Days | 3.2 | 3.2 | 2.4 | 3.0 |
| Turnover | 33.4 | 43.2 | 39.8 | 36.9 |
| Exposure | 14.6% | 19.3% | 10.7% | 14.6% |
Growth of $100
Walk-Forward Years
| Year | CAGR | Sharpe | Max DD | Trades |
|---|---|---|---|---|
| 2016 | -9.2% | -1.15 | -12.6% | 18 |
| 2017 | 11.6% | 0.78 | -10.1% | 31 |
| 2018 | -9.0% | -1.15 | -12.9% | 8 |
| 2019 | 0.0% | 0.06 | -12.1% | 9 |
| 2020 | 115.6% | 2.84 | -7.2% | 14 |
| 2021 | 7.5% | 0.41 | -24.3% | 50 |
| 2022 | -7.0% | -0.78 | -11.6% | 16 |
A robust strategy performs acceptably in most years rather than spectacularly in one — look for consistency across regimes, not a single outlier year.
Regime Performance
| Period | Regime | Days | Ann. Return | Sharpe | Exposure |
|---|---|---|---|---|---|
| hidden test | DOWNTREND | 268 | -1.8% | -1.06 | 0% |
| hidden test | EXPENSIVE | 83 | -10.4% | -0.45 | 20% |
| hidden test | EXTREME | 48 | -19.2% | -2.92 | 3% |
| hidden test | HIGH VOLATILITY | 254 | -16.1% | -1.11 | 1% |
| hidden test | LOW VOLATILITY | 429 | -3.7% | -0.26 | 16% |
| hidden test | MEDIUM VOLATILITY | 249 | -31.9% | -1.94 | 12% |
| hidden test | NORMAL | 801 | -14.8% | -1.04 | 10% |
| hidden test | SIDEWAYS | 293 | -31.0% | -1.80 | 14% |
| hidden test | UPTREND | 371 | -11.0% | -0.61 | 16% |
| train | DOWNTREND | 518 | -5.5% | -1.04 | 0% |
| train | EXPENSIVE | 311 | 23.1% | 0.97 | 25% |
| train | EXTREME | 100 | 34.3% | 1.80 | 21% |
| train | HIGH VOLATILITY | 699 | -1.2% | -0.09 | 1% |
| train | LOW VOLATILITY | 745 | 8.5% | 0.55 | 25% |
| train | MEDIUM VOLATILITY | 568 | -19.5% | -1.10 | 18% |
| train | NORMAL | 1,601 | -10.1% | -0.75 | 12% |
| train | SIDEWAYS | 592 | -8.4% | -0.72 | 11% |
| train | UPTREND | 902 | 2.5% | 0.12 | 25% |
| validation | DOWNTREND | 125 | 0.0% | 0.00 | 0% |
| validation | EXPENSIVE | 138 | 53.2% | 1.63 | 37% |
| validation | EXTREME | 144 | 105.3% | 3.89 | 16% |
| validation | HIGH VOLATILITY | 258 | 4.6% | 0.33 | 1% |
| validation | LOW VOLATILITY | 183 | 29.0% | 1.74 | 28% |
| validation | MEDIUM VOLATILITY | 315 | 47.2% | 1.55 | 29% |
| validation | NORMAL | 474 | -2.5% | -0.15 | 15% |
| validation | SIDEWAYS | 206 | -10.0% | -1.18 | 9% |
| validation | UPTREND | 425 | 55.1% | 1.85 | 30% |
Trades (full period)
| Entry | Exit | Entry Px | Exit Px | Return | Days | |
|---|---|---|---|---|---|---|
| 2026-07-01 | 2026-07-02 | $425.30 | $393.45 | 0.73% | 2 | |
| 2026-06-05 | 2026-06-08 | $391.00 | $408.95 | -5.40% | 2 | |
| 2026-06-03 | 2026-06-04 | $423.70 | $418.45 | -0.17% | 2 | |
| 2026-05-28 | 2026-06-02 | $442.10 | $423.74 | -4.61% | 4 | |
| 2026-05-26 | 2026-05-27 | $433.59 | $440.36 | 1.26% | 2 | |
| 2026-05-21 | 2026-05-22 | $417.85 | $426.01 | -0.05% | 2 | |
| 2026-05-19 | 2026-05-20 | $404.11 | $417.26 | -1.31% | 2 | |
| 2026-05-12 | 2026-05-18 | $433.45 | $409.99 | -4.24% | 5 | |
| 2026-05-08 | 2026-05-11 | $428.35 | $445.00 | 3.05% | 2 | |
| 2026-04-20 | 2026-04-21 | $392.50 | $386.42 | -1.78% | 2 | |
| 2025-12-31 | 2026-01-02 | $449.72 | $438.07 | -0.99% | 2 | |
| 2025-12-04 | 2025-12-30 | $454.53 | $454.43 | 2.22% | 18 | |
| 2025-11-06 | 2025-11-07 | $445.91 | $429.52 | -2.96% | 2 | |
| 2025-11-03 | 2025-11-05 | $468.37 | $462.07 | -2.29% | 3 | |
| 2025-10-24 | 2025-10-27 | $433.72 | $452.42 | -2.88% | 2 | |
| 2025-10-13 | 2025-10-14 | $435.90 | $429.24 | 4.17% | 2 | |
| 2025-10-09 | 2025-10-10 | $435.54 | $413.49 | -0.73% | 2 | |
| 2025-10-07 | 2025-10-08 | $433.09 | $438.69 | -3.72% | 2 | |
| 2025-09-19 | 2025-10-06 | $426.07 | $453.25 | 2.41% | 12 | |
| 2025-09-12 | 2025-09-15 | $395.94 | $410.04 | 5.72% | 2 | |
| 2025-09-10 | 2025-09-11 | $347.79 | $368.81 | 0.03% | 2 | |
| 2025-09-08 | 2025-09-09 | $346.40 | $346.97 | -1.17% | 2 | |
| 2025-09-04 | 2025-09-05 | $338.53 | $350.84 | 0.90% | 2 | |
| 2025-08-29 | 2025-09-02 | $333.87 | $329.36 | -2.96% | 2 | |
| 2025-08-27 | 2025-08-28 | $349.60 | $345.98 | -0.63% | 2 | |
| 2025-08-25 | 2025-08-26 | $346.60 | $351.67 | 1.39% | 2 | |
| 2025-08-19 | 2025-08-20 | $329.31 | $323.90 | -1.56% | 2 | |
| 2025-08-15 | 2025-08-18 | $330.56 | $335.16 | -1.36% | 2 | |
| 2025-08-13 | 2025-08-14 | $339.38 | $335.58 | -0.50% | 2 | |
| 2025-08-11 | 2025-08-12 | $339.03 | $340.84 | 2.11% | 2 | |
| 2025-07-29 | 2025-07-30 | $321.20 | $319.04 | -1.24% | 2 | |
| 2025-07-23 | 2025-07-24 | $332.56 | $305.30 | -0.05% | 2 | |
| 2025-07-21 | 2025-07-22 | $328.49 | $332.11 | -0.44% | 2 | |
| 2025-06-05 | 2025-06-06 | $284.70 | $295.14 | -11.56% | 2 | |
| 2025-06-03 | 2025-06-04 | $344.27 | $332.05 | 0.21% | 2 | |
| 2025-05-30 | 2025-06-02 | $346.46 | $342.69 | -2.83% | 2 | |
| 2025-05-28 | 2025-05-29 | $356.90 | $358.43 | -1.48% | 2 | |
| 2025-05-23 | 2025-05-27 | $339.34 | $362.89 | -0.56% | 2 | |
| 2025-05-21 | 2025-05-22 | $334.62 | $341.04 | -2.30% | 2 | |
| 2025-05-19 | 2025-05-20 | $342.09 | $343.82 | -1.96% | 2 | |
| 2025-05-12 | 2025-05-13 | $318.38 | $334.07 | 5.23% | 2 | |
| 2024-12-19 | 2024-12-23 | $436.17 | $430.60 | -3.63% | 3 | |
| 2024-10-09 | 2024-10-10 | $241.05 | $238.77 | -1.29% | 2 | |
| 2024-10-07 | 2024-10-08 | $240.83 | $244.50 | -3.12% | 2 | |
| 2024-10-03 | 2024-10-04 | $240.66 | $250.08 | -2.84% | 2 | |
| 2024-10-01 | 2024-10-02 | $258.02 | $249.02 | -1.26% | 2 | |
| 2024-09-27 | 2024-09-30 | $260.46 | $261.63 | 1.80% | 2 | |
| 2024-09-25 | 2024-09-26 | $257.02 | $254.22 | 0.70% | 2 | |
| 2024-09-23 | 2024-09-24 | $250.00 | $254.27 | 3.78% | 2 | |
| 2024-09-18 | 2024-09-19 | $227.20 | $243.92 | -0.40% | 2 | |
| 2024-09-16 | 2024-09-17 | $226.78 | $227.87 | -1.38% | 2 | |
| 2024-09-06 | 2024-09-09 | $210.73 | $216.27 | -6.91% | 2 | |
| 2024-07-02 | 2024-07-03 | $231.26 | $246.39 | 7.99% | 2 | |
| 2024-01-03 | 2024-01-04 | $238.45 | $237.93 | -3.37% | 2 | |
| 2023-12-28 | 2023-12-29 | $253.18 | $248.48 | -2.69% | 2 | |
| 2023-12-26 | 2023-12-27 | $256.61 | $261.44 | 1.13% | 2 | |
| 2023-12-21 | 2023-12-22 | $254.50 | $252.54 | 2.22% | 2 | |
| 2023-12-19 | 2023-12-20 | $257.22 | $247.14 | 1.47% | 2 | |
| 2023-12-15 | 2023-12-18 | $253.50 | $252.08 | 0.62% | 2 | |
| 2023-12-13 | 2023-12-14 | $239.29 | $251.05 | 0.61% | 2 | |
| 2023-12-11 | 2023-12-12 | $239.74 | $237.01 | -1.50% | 2 | |
| 2023-12-07 | 2023-12-08 | $242.64 | $243.84 | 0.93% | 2 | |
| 2023-12-05 | 2023-12-06 | $238.72 | $239.37 | 0.91% | 2 | |
| 2023-12-01 | 2023-12-04 | $238.83 | $235.58 | -0.58% | 2 | |
| 2023-11-29 | 2023-11-30 | $244.14 | $240.08 | -1.00% | 2 | |
| 2023-11-22 | 2023-11-24 | $234.21 | $235.45 | -2.48% | 2 | |
| 2023-11-16 | 2023-11-17 | $233.59 | $234.30 | -3.20% | 2 | |
| 2023-10-16 | 2023-10-17 | $253.92 | $254.85 | 0.73% | 2 | |
| 2023-10-12 | 2023-10-13 | $258.87 | $251.12 | -1.41% | 2 | |
| 2023-10-10 | 2023-10-11 | $263.62 | $262.99 | 1.06% | 2 | |
| 2023-10-06 | 2023-10-09 | $260.53 | $259.67 | -0.01% | 2 | |
| 2023-09-20 | 2023-09-21 | $262.59 | $255.70 | -1.33% | 2 | |
| 2023-09-18 | 2023-09-19 | $265.28 | $266.50 | -2.81% | 2 | |
| 2023-09-14 | 2023-09-15 | $276.04 | $274.39 | 1.24% | 2 | |
| 2023-09-12 | 2023-09-13 | $267.48 | $271.30 | -1.94% | 2 | |
| 2023-09-06 | 2023-09-07 | $251.92 | $251.49 | -1.58% | 2 | |
| 2023-09-01 | 2023-09-05 | $245.01 | $256.49 | -4.21% | 2 | |
| 2023-08-30 | 2023-08-31 | $256.90 | $258.08 | -0.25% | 2 | |
| 2023-07-27 | 2023-07-28 | $255.71 | $266.44 | -2.77% | 2 | |
| 2023-07-25 | 2023-07-26 | $265.28 | $264.35 | -1.28% | 2 | |
| 2023-07-19 | 2023-07-20 | $291.26 | $262.90 | -0.73% | 2 | |
| 2023-07-17 | 2023-07-18 | $290.38 | $293.34 | 2.40% | 2 | |
| 2023-07-13 | 2023-07-14 | $277.90 | $281.38 | 1.58% | 2 | |
| 2023-07-11 | 2023-07-12 | $269.79 | $271.99 | -0.11% | 2 | |
| 2023-07-07 | 2023-07-10 | $274.43 | $269.61 | -0.77% | 2 | |
| 2023-07-05 | 2023-07-06 | $282.48 | $276.54 | 0.60% | 2 | |
| 2023-06-30 | 2023-07-03 | $261.77 | $279.82 | 1.17% | 2 | |
| 2023-06-28 | 2023-06-29 | $256.24 | $257.50 | 1.77% | 2 | |
| 2023-06-26 | 2023-06-27 | $241.05 | $250.21 | -5.00% | 2 | |
| 2023-06-22 | 2023-06-23 | $264.61 | $256.60 | 1.43% | 2 | |
| 2023-06-02 | 2023-06-05 | $213.97 | $217.61 | 2.32% | 2 | |
| 2023-05-31 | 2023-06-01 | $203.93 | $207.52 | 0.94% | 2 | |
| 2022-09-21 | 2022-09-22 | $300.80 | $288.59 | -2.21% | 2 | |
| 2022-09-19 | 2022-09-20 | $309.07 | $308.73 | 1.35% | 2 | |
| 2022-09-15 | 2022-09-16 | $303.75 | $303.35 | 0.14% | 2 | |
| 2022-09-12 | 2022-09-13 | $304.42 | $292.13 | 1.10% | 2 | |
| 2022-08-18 | 2022-08-19 | $302.87 | $296.67 | -0.46% | 2 | |
| 2022-08-16 | 2022-08-17 | $306.56 | $304.00 | -0.87% | 2 | |
| 2022-08-04 | 2022-08-05 | $308.63 | $288.17 | 0.16% | 2 | |
| 2022-04-19 | 2022-04-20 | $342.72 | $325.73 | 1.74% | 2 |