LongTermTrend_V0637
ARCHIVEDhybridllm1) Simplified and strengthened entry to require momentum OR breakout plus a trend confirmation (sma50>sma200 or positive macd_hist). 2) Relaxed sma_200_slope threshold to avoid overfitting and added a short-term ret_5d filter to capture recent momentum. 3) Improved exit: exit on negative macd_hist OR sharp 5-day loss OR >8% drawdown to cut losses earlier. 4) Added regime gates to avoid entering in downtrends and high volatility, and to avoid extreme bubble regimes. 5) Added volatility-based position scaling (reduce size in high vol) and reduced base position to 0.9 to lower risk.
Lineage
entry = LongTermTrend_V0235 OR MACDMomentum_V0272
Strategy Logic (pseudocode)
# LongTermTrend_V0637 [hybrid]
require regime.trend in ['UPTREND', 'SIDEWAYS']
require regime.volatility in ['LOW_VOLATILITY', 'MEDIUM_VOLATILITY']
require regime.bubble in ['NORMAL', 'EXPENSIVE']
if flat and (((close > sma_200 and sma_200_slope > -0.001) or (ret_20d > 0.04 and ret_5d > 0.01) or (breakout_50 == 1 and rel_volume > 1.3)) and (sma_50 > sma_200 or macd_hist > 0.0)):
position = 0.9
if long and (macd_hist < 0.0 or ret_5d < -0.06 or drawdown < -0.08):
position = 0.0 # exit to cashBacktest Metrics
| Metric | Train | Validation | Hidden Test | Full |
|---|---|---|---|---|
| CAGR | -12.5% | 14.4% | -13.1% | -7.6% |
| Total Return | -65.6% | 49.8% | -40.5% | -68.5% |
| Sharpe | -0.54 | 0.64 | -0.55 | -0.24 |
| Sortino | -0.43 | 0.64 | -0.49 | -0.21 |
| Calmar | -0.18 | 0.35 | -0.26 | -0.11 |
| Volatility | 20.7% | 26.5% | 21.2% | 22.1% |
| Max DD | -70.4% | -40.9% | -50.8% | -70.4% |
| Win Rate | 42.9% | 46.8% | 42.2% | 43.6% |
| Avg Win | 2.1% | 3.4% | 2.2% | 2.5% |
| Avg Loss | -2.1% | -2.2% | -2.0% | -2.1% |
| Payoff | 0.99 | 1.54 | 1.09 | 1.19 |
| Expectancy | -0.3% | 0.4% | -0.2% | -0.1% |
| Profit Factor | 0.74 | 1.36 | 0.80 | 0.91 |
| Trades | 331 | 141 | 187 | 659 |
| Avg Holding Days | 2.4 | 2.4 | 2.1 | 2.3 |
| Turnover | 74.7 | 84.6 | 90.8 | 80.7 |
| Exposure | 21.0% | 23.2% | 19.9% | 21.2% |
Growth of $100
Walk-Forward Years
| Year | CAGR | Sharpe | Max DD | Trades |
|---|---|---|---|---|
| 2016 | -12.4% | -1.20 | -15.5% | 28 |
| 2017 | 18.6% | 0.84 | -17.2% | 61 |
| 2018 | -12.9% | -1.72 | -14.2% | 13 |
| 2019 | 4.6% | 0.46 | -11.7% | 16 |
| 2020 | 77.5% | 2.46 | -10.3% | 23 |
| 2021 | -10.2% | -0.16 | -40.9% | 83 |
| 2022 | -6.0% | -0.21 | -19.1% | 33 |
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 | 270 | -7.9% | -1.68 | 1% |
| hidden test | EXPENSIVE | 83 | -38.7% | -1.31 | 35% |
| hidden test | EXTREME | 48 | 0.0% | 0.00 | 0% |
| hidden test | HIGH VOLATILITY | 254 | -2.3% | -0.24 | 1% |
| hidden test | LOW VOLATILITY | 430 | -3.4% | -0.17 | 28% |
| hidden test | MEDIUM VOLATILITY | 250 | -35.6% | -1.22 | 25% |
| hidden test | NORMAL | 803 | -9.6% | -0.46 | 20% |
| hidden test | SIDEWAYS | 293 | -30.3% | -1.36 | 24% |
| hidden test | UPTREND | 371 | 0.1% | 0.00 | 31% |
| train | DOWNTREND | 518 | -17.5% | -1.27 | 1% |
| train | EXPENSIVE | 311 | 32.2% | 1.04 | 37% |
| train | EXTREME | 100 | 10.5% | 1.55 | 1% |
| train | HIGH VOLATILITY | 699 | -7.9% | -0.39 | 2% |
| train | LOW VOLATILITY | 745 | -9.7% | -0.51 | 34% |
| train | MEDIUM VOLATILITY | 568 | -17.2% | -0.73 | 27% |
| train | NORMAL | 1,601 | -21.0% | -1.12 | 19% |
| train | SIDEWAYS | 592 | -16.8% | -0.99 | 18% |
| train | UPTREND | 902 | -3.8% | -0.15 | 35% |
| validation | DOWNTREND | 125 | -5.1% | -1.73 | 1% |
| validation | EXPENSIVE | 138 | 88.9% | 2.64 | 44% |
| validation | EXTREME | 144 | 47.6% | 2.85 | 3% |
| validation | HIGH VOLATILITY | 258 | -7.8% | -0.69 | 1% |
| validation | LOW VOLATILITY | 183 | 4.7% | 0.26 | 32% |
| validation | MEDIUM VOLATILITY | 315 | 44.3% | 1.19 | 37% |
| validation | NORMAL | 474 | -13.3% | -0.51 | 23% |
| validation | SIDEWAYS | 206 | -24.7% | -1.00 | 22% |
| validation | UPTREND | 425 | 43.6% | 1.42 | 30% |
Trades (full period)
| Entry | Exit | Entry Px | Exit Px | Return | Days | |
|---|---|---|---|---|---|---|
| 2026-07-01 | 2026-07-02 | $425.30 | $393.45 | 0.82% | 2 | |
| 2026-06-01 | 2026-06-02 | $415.88 | $423.74 | -4.29% | 2 | |
| 2026-05-28 | 2026-05-29 | $442.10 | $435.79 | 0.18% | 2 | |
| 2026-05-18 | 2026-05-19 | $409.99 | $404.11 | -2.79% | 2 | |
| 2026-05-14 | 2026-05-15 | $443.30 | $422.24 | -0.58% | 2 | |
| 2026-05-12 | 2026-05-13 | $433.45 | $445.27 | -2.51% | 2 | |
| 2026-05-08 | 2026-05-11 | $428.35 | $445.00 | 3.44% | 2 | |
| 2026-04-20 | 2026-04-21 | $392.50 | $386.42 | -2.00% | 2 | |
| 2026-03-17 | 2026-03-18 | $399.27 | $392.78 | 0.66% | 2 | |
| 2026-03-12 | 2026-03-13 | $395.01 | $391.20 | -3.00% | 2 | |
| 2026-03-10 | 2026-03-11 | $399.24 | $407.82 | -0.05% | 2 | |
| 2026-03-06 | 2026-03-09 | $396.73 | $398.68 | -2.14% | 2 | |
| 2026-03-04 | 2026-03-05 | $405.94 | $405.55 | 2.92% | 2 | |
| 2026-03-02 | 2026-03-03 | $403.32 | $392.43 | 0.00% | 2 | |
| 2026-02-26 | 2026-02-27 | $408.58 | $402.51 | -2.08% | 2 | |
| 2026-02-24 | 2026-02-25 | $409.38 | $417.40 | 1.97% | 2 | |
| 2026-02-20 | 2026-02-23 | $411.82 | $399.83 | -0.16% | 2 | |
| 2026-02-18 | 2026-02-19 | $411.32 | $411.71 | -0.03% | 2 | |
| 2026-02-13 | 2026-02-17 | $417.44 | $410.63 | -0.10% | 2 | |
| 2026-02-11 | 2026-02-12 | $428.27 | $417.07 | 0.47% | 2 | |
| 2026-02-09 | 2026-02-10 | $417.32 | $425.21 | 1.18% | 2 | |
| 2026-02-05 | 2026-02-06 | $397.21 | $411.11 | -2.13% | 2 | |
| 2026-02-03 | 2026-02-04 | $421.96 | $406.01 | -0.15% | 2 | |
| 2026-01-30 | 2026-02-02 | $430.41 | $421.81 | 2.81% | 2 | |
| 2026-01-28 | 2026-01-29 | $431.46 | $416.56 | -0.06% | 2 | |
| 2026-01-26 | 2026-01-27 | $435.20 | $430.90 | -2.96% | 2 | |
| 2026-01-22 | 2026-01-23 | $449.36 | $449.06 | 3.55% | 2 | |
| 2026-01-20 | 2026-01-21 | $419.25 | $431.44 | -3.93% | 2 | |
| 2026-01-15 | 2026-01-16 | $438.57 | $437.50 | -0.31% | 2 | |
| 2026-01-13 | 2026-01-14 | $447.20 | $439.20 | -0.53% | 2 | |
| 2026-01-09 | 2026-01-12 | $445.01 | $448.96 | 1.72% | 2 | |
| 2026-01-07 | 2026-01-08 | $431.41 | $435.80 | -0.50% | 2 | |
| 2026-01-05 | 2026-01-06 | $451.67 | $432.96 | 2.61% | 2 | |
| 2025-12-31 | 2026-01-02 | $449.72 | $438.07 | -1.11% | 2 | |
| 2025-12-10 | 2025-12-30 | $451.45 | $454.43 | 2.78% | 14 | |
| 2025-12-03 | 2025-12-09 | $446.74 | $445.17 | 2.00% | 5 | |
| 2025-12-01 | 2025-12-02 | $430.14 | $429.24 | -0.19% | 2 | |
| 2025-11-26 | 2025-11-28 | $426.58 | $430.17 | 1.36% | 2 | |
| 2025-11-24 | 2025-11-25 | $417.78 | $419.40 | 5.96% | 2 | |
| 2025-11-20 | 2025-11-21 | $395.23 | $391.09 | -2.13% | 2 | |
| 2025-11-18 | 2025-11-19 | $401.25 | $403.99 | -1.87% | 2 | |
| 2025-11-14 | 2025-11-17 | $404.35 | $408.92 | 0.35% | 2 | |
| 2025-11-12 | 2025-11-13 | $430.60 | $401.99 | -2.02% | 2 | |
| 2025-11-10 | 2025-11-11 | $445.23 | $439.62 | 3.11% | 2 | |
| 2025-11-06 | 2025-11-07 | $445.91 | $429.52 | -3.32% | 2 | |
| 2025-11-03 | 2025-11-05 | $468.37 | $462.07 | -2.59% | 3 | |
| 2025-10-30 | 2025-10-31 | $440.10 | $456.56 | -4.35% | 2 | |
| 2025-10-28 | 2025-10-29 | $460.55 | $461.51 | 1.44% | 2 | |
| 2025-10-24 | 2025-10-27 | $433.72 | $452.42 | -3.24% | 2 | |
| 2025-10-22 | 2025-10-23 | $438.97 | $448.98 | -0.92% | 2 | |
| 2025-10-20 | 2025-10-21 | $447.43 | $442.60 | 1.48% | 2 | |
| 2025-10-16 | 2025-10-17 | $428.75 | $439.31 | -1.50% | 2 | |
| 2025-10-14 | 2025-10-15 | $429.24 | $435.15 | -1.55% | 2 | |
| 2025-10-10 | 2025-10-13 | $413.49 | $435.90 | -4.73% | 2 | |
| 2025-10-08 | 2025-10-09 | $438.69 | $435.54 | 0.98% | 2 | |
| 2025-10-06 | 2025-10-07 | $453.25 | $433.09 | 4.72% | 2 | |
| 2025-09-29 | 2025-10-03 | $443.21 | $429.83 | -1.06% | 5 | |
| 2025-09-24 | 2025-09-26 | $442.79 | $440.40 | -0.68% | 3 | |
| 2025-09-22 | 2025-09-23 | $434.21 | $425.85 | 1.54% | 2 | |
| 2025-09-18 | 2025-09-19 | $416.85 | $426.07 | -2.08% | 2 | |
| 2025-09-16 | 2025-09-17 | $421.62 | $425.86 | 2.36% | 2 | |
| 2025-09-12 | 2025-09-15 | $395.94 | $410.04 | 6.43% | 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.32% | 2 | |
| 2025-08-29 | 2025-09-02 | $333.87 | $329.36 | -3.33% | 2 | |
| 2025-08-27 | 2025-08-28 | $349.60 | $345.98 | -0.71% | 2 | |
| 2025-08-25 | 2025-08-26 | $346.60 | $351.67 | 1.56% | 2 | |
| 2025-08-19 | 2025-08-20 | $329.31 | $323.90 | -1.75% | 2 | |
| 2025-08-15 | 2025-08-18 | $330.56 | $335.16 | -1.52% | 2 | |
| 2025-08-13 | 2025-08-14 | $339.38 | $335.58 | -0.57% | 2 | |
| 2025-08-11 | 2025-08-12 | $339.03 | $340.84 | 2.38% | 2 | |
| 2025-07-29 | 2025-07-30 | $321.20 | $319.04 | -1.39% | 2 | |
| 2025-07-23 | 2025-07-24 | $332.56 | $305.30 | -0.06% | 2 | |
| 2025-07-21 | 2025-07-22 | $328.49 | $332.11 | -0.50% | 2 | |
| 2025-07-17 | 2025-07-18 | $319.41 | $329.65 | -0.81% | 2 | |
| 2025-07-15 | 2025-07-16 | $310.78 | $321.67 | -1.92% | 2 | |
| 2025-05-30 | 2025-06-02 | $346.46 | $342.69 | -3.18% | 2 | |
| 2025-05-28 | 2025-05-29 | $356.90 | $358.43 | -1.66% | 2 | |
| 2025-05-23 | 2025-05-27 | $339.34 | $362.89 | -0.63% | 2 | |
| 2025-05-21 | 2025-05-22 | $334.62 | $341.04 | -2.59% | 2 | |
| 2025-05-19 | 2025-05-20 | $342.09 | $343.82 | -2.21% | 2 | |
| 2025-05-12 | 2025-05-13 | $318.38 | $334.07 | 5.89% | 2 | |
| 2025-03-04 | 2025-03-05 | $272.04 | $279.10 | -4.16% | 2 | |
| 2025-02-27 | 2025-02-28 | $281.95 | $292.98 | -2.92% | 2 | |
| 2025-02-25 | 2025-02-26 | $302.80 | $290.80 | -7.72% | 2 | |
| 2025-02-21 | 2025-02-24 | $337.80 | $330.53 | -4.39% | 2 | |
| 2025-02-19 | 2025-02-20 | $360.56 | $354.40 | 1.46% | 2 | |
| 2025-02-14 | 2025-02-18 | $355.84 | $354.11 | -0.21% | 2 | |
| 2025-02-12 | 2025-02-13 | $336.51 | $355.94 | 2.01% | 2 | |
| 2025-02-10 | 2025-02-11 | $350.73 | $328.50 | -2.89% | 2 | |
| 2025-02-06 | 2025-02-07 | $374.32 | $361.62 | -1.10% | 2 | |
| 2024-10-23 | 2024-10-24 | $213.65 | $260.48 | -1.96% | 2 | |
| 2024-10-21 | 2024-10-22 | $218.85 | $217.97 | -0.93% | 2 | |
| 2024-10-17 | 2024-10-18 | $220.89 | $220.70 | -0.36% | 2 | |
| 2024-10-15 | 2024-10-16 | $219.57 | $221.33 | -0.01% | 2 | |
| 2024-10-11 | 2024-10-14 | $217.80 | $219.16 | -8.08% | 2 | |
| 2024-10-09 | 2024-10-10 | $241.05 | $238.77 | -1.45% | 2 | |
| 2024-10-07 | 2024-10-08 | $240.83 | $244.50 | -3.51% | 2 | |
| 2024-10-03 | 2024-10-04 | $240.66 | $250.08 | -3.20% | 2 | |
| 2024-10-01 | 2024-10-02 | $258.02 | $249.02 | -1.42% | 2 |