LongTermTrend_V0923
ARCHIVEDhybridllm- Added a short-term momentum gate (sma_50_slope > 0) to reduce false entries and improve generalization - Replaced single MACD exit with an OR exit: MACD histogram < 0 OR price crossing below sma_50 OR a 15% drawdown stop to limit large losses - Added regime gates: require UPTREND, avoid extreme bubble states, and limit operation to medium-or-lower volatility regimes to reduce exposure during chaotic periods - Reduced base_position from 1.0 to 0.9 to lower overall leverage/exposure and improve robustness
Lineage
changed sma_200_slope threshold -0.0024 -> -0.0003; changed cumret_252d threshold -0.1997 -> 0.2888
Strategy Logic (pseudocode)
# LongTermTrend_V0923 [hybrid]
if flat and (((((close > sma_200 and sma_200_slope > -0.0003) or ret_20d > 0.085) and ret_20d > 0.05 and cumret_252d > 0.2888 and dist_sma_50 > -0.0774) or ((macd_hist > 0.0 and close > sma_50) or ((breakout_50 == 1 and rel_volume > 2.0784) or ((macd_hist > 0.0 and close > sma_50) and sma_50 > sma_200)))) and sma_50_slope > 0.0):
position = 0.9
if long and (macd_hist < 0.0 or close < sma_50 or drawdown < -0.15):
position = 0.0 # exit to cashBacktest Metrics
| Metric | Train | Validation | Hidden Test | Full |
|---|---|---|---|---|
| CAGR | 14.6% | 32.7% | -10.5% | 11.1% |
| Total Return | 196.2% | 133.7% | -33.8% | 370.1% |
| Sharpe | 0.68 | 0.94 | -0.42 | 0.52 |
| Sortino | 0.61 | 0.87 | -0.30 | 0.44 |
| Calmar | 0.34 | 0.77 | -0.28 | 0.18 |
| Volatility | 24.4% | 37.6% | 21.3% | 27.0% |
| Max DD | -43.0% | -42.2% | -37.8% | -61.8% |
| Win Rate | 46.6% | 53.5% | 41.8% | 47.1% |
| Avg Win | 5.1% | 5.3% | 3.3% | 4.9% |
| Avg Loss | -2.4% | -3.3% | -3.0% | -2.8% |
| Payoff | 2.17 | 1.64 | 1.10 | 1.76 |
| Expectancy | 1.1% | 1.3% | -0.4% | 0.8% |
| Profit Factor | 1.89 | 1.88 | 0.79 | 1.57 |
| Trades | 133 | 86 | 91 | 310 |
| Avg Holding Days | 4.6 | 3.7 | 2.5 | 3.8 |
| Turnover | 30.1 | 51.6 | 44.0 | 37.9 |
| Exposure | 21.8% | 28.0% | 13.2% | 20.9% |
Growth of $100
Walk-Forward Years
| Year | CAGR | Sharpe | Max DD | Trades |
|---|---|---|---|---|
| 2016 | 1.9% | 0.28 | -7.1% | 9 |
| 2017 | 5.0% | 0.35 | -13.2% | 25 |
| 2018 | -23.0% | -1.18 | -24.3% | 8 |
| 2019 | 25.1% | 1.08 | -15.1% | 18 |
| 2020 | 149.9% | 1.89 | -32.6% | 37 |
| 2021 | 27.7% | 1.03 | -20.8% | 30 |
| 2022 | -27.0% | -2.19 | -26.9% | 17 |
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 | 274 | 0.0% | 0.00 | 0% |
| hidden test | EXPENSIVE | 83 | 20.0% | 0.48 | 38% |
| hidden test | EXTREME | 48 | 80.7% | 2.11 | 39% |
| hidden test | HIGH VOLATILITY | 254 | -40.6% | -1.39 | 14% |
| hidden test | LOW VOLATILITY | 434 | 18.0% | 1.17 | 13% |
| hidden test | MEDIUM VOLATILITY | 250 | -23.2% | -1.13 | 12% |
| hidden test | NORMAL | 807 | -17.1% | -1.05 | 9% |
| hidden test | SIDEWAYS | 293 | -28.9% | -1.70 | 10% |
| hidden test | UPTREND | 371 | 0.5% | 0.02 | 26% |
| train | DOWNTREND | 518 | -0.4% | -0.78 | 0% |
| train | EXPENSIVE | 311 | 22.2% | 0.72 | 45% |
| train | EXTREME | 100 | 313.3% | 4.87 | 75% |
| train | HIGH VOLATILITY | 699 | 29.6% | 0.86 | 24% |
| train | LOW VOLATILITY | 745 | 14.8% | 0.93 | 26% |
| train | MEDIUM VOLATILITY | 568 | 2.7% | 0.15 | 14% |
| train | NORMAL | 1,601 | -3.1% | -0.19 | 14% |
| train | SIDEWAYS | 592 | -3.4% | -0.33 | 8% |
| train | UPTREND | 902 | 39.3% | 1.11 | 43% |
| validation | DOWNTREND | 125 | 0.0% | 0.00 | 0% |
| validation | EXPENSIVE | 138 | 25.7% | 0.60 | 42% |
| validation | EXTREME | 144 | 189.8% | 2.89 | 55% |
| validation | HIGH VOLATILITY | 258 | 20.6% | 0.40 | 24% |
| validation | LOW VOLATILITY | 183 | 19.7% | 1.09 | 28% |
| validation | MEDIUM VOLATILITY | 315 | 56.5% | 1.74 | 31% |
| validation | NORMAL | 474 | -8.7% | -0.45 | 16% |
| validation | SIDEWAYS | 206 | 1.4% | 0.20 | 3% |
| validation | UPTREND | 425 | 62.2% | 1.25 | 48% |
Trades (full period)
| Entry | Exit | Entry Px | Exit Px | Return | Days | |
|---|---|---|---|---|---|---|
| 2026-07-07 | 2026-07-08 | $402.90 | $394.06 | -3.79% | 2 | |
| 2026-07-01 | 2026-07-06 | $425.30 | $419.77 | -5.97% | 3 | |
| 2026-05-28 | 2026-06-02 | $442.10 | $423.74 | -5.18% | 4 | |
| 2026-05-20 | 2026-05-21 | $417.26 | $417.85 | 2.75% | 2 | |
| 2026-05-14 | 2026-05-19 | $443.30 | $404.11 | -7.31% | 4 | |
| 2025-12-04 | 2025-12-30 | $454.53 | $454.43 | 2.46% | 18 | |
| 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-24 | 2025-10-27 | $433.72 | $452.42 | -3.24% | 2 | |
| 2025-10-14 | 2025-10-15 | $429.24 | $435.15 | -1.55% | 2 | |
| 2025-10-09 | 2025-10-10 | $435.54 | $413.49 | -0.83% | 2 | |
| 2025-10-07 | 2025-10-08 | $433.09 | $438.69 | -4.18% | 2 | |
| 2025-09-16 | 2025-10-06 | $421.62 | $453.25 | 4.20% | 15 | |
| 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-09-04 | 2025-09-05 | $338.53 | $350.84 | 1.02% | 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-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-06-25 | 2025-06-26 | $327.55 | $325.78 | -3.59% | 2 | |
| 2025-06-04 | 2025-06-05 | $332.05 | $284.70 | -3.37% | 2 | |
| 2025-06-02 | 2025-06-03 | $342.69 | $344.27 | -1.16% | 2 | |
| 2025-05-29 | 2025-05-30 | $358.43 | $346.46 | 0.21% | 2 | |
| 2025-05-27 | 2025-05-28 | $362.89 | $356.90 | 6.06% | 2 | |
| 2025-05-22 | 2025-05-23 | $341.04 | $339.34 | 1.55% | 2 | |
| 2025-05-20 | 2025-05-21 | $343.82 | $334.62 | 0.27% | 2 | |
| 2025-05-16 | 2025-05-19 | $349.98 | $342.09 | 1.70% | 2 | |
| 2025-01-06 | 2025-01-07 | $411.05 | $394.36 | -0.05% | 2 | |
| 2025-01-02 | 2025-01-03 | $379.28 | $410.44 | -5.65% | 2 | |
| 2024-12-30 | 2024-12-31 | $417.41 | $403.84 | -3.15% | 2 | |
| 2024-12-26 | 2024-12-27 | $454.13 | $431.66 | -1.77% | 2 | |
| 2024-12-06 | 2024-12-24 | $389.22 | $462.28 | 14.69% | 13 | |
| 2024-12-04 | 2024-12-05 | $357.93 | $369.49 | 1.49% | 2 | |
| 2024-12-02 | 2024-12-03 | $357.09 | $351.42 | 2.93% | 2 | |
| 2024-11-27 | 2024-11-29 | $332.89 | $345.16 | -1.60% | 2 | |
| 2024-11-22 | 2024-11-26 | $352.56 | $338.23 | -0.44% | 3 | |
| 2024-11-20 | 2024-11-21 | $342.03 | $339.64 | -1.21% | 2 | |
| 2024-11-18 | 2024-11-19 | $338.74 | $346.00 | 4.87% | 2 | |
| 2024-11-14 | 2024-11-15 | $311.18 | $320.72 | -5.37% | 2 | |
| 2024-11-12 | 2024-11-13 | $328.49 | $330.24 | -5.71% | 2 | |
| 2024-11-08 | 2024-11-11 | $321.22 | $350.00 | 7.18% | 2 | |
| 2024-11-06 | 2024-11-07 | $288.53 | $296.91 | 13.08% | 2 | |
| 2024-11-04 | 2024-11-05 | $242.84 | $251.44 | -2.40% | 2 | |
| 2024-10-31 | 2024-11-01 | $249.85 | $248.98 | -2.87% | 2 | |
| 2024-10-29 | 2024-10-30 | $259.52 | $257.55 | -1.20% | 2 | |
| 2024-10-25 | 2024-10-28 | $269.19 | $262.51 | 2.83% | 2 | |
| 2024-10-03 | 2024-10-04 | $240.66 | $250.08 | -3.20% | 2 | |
| 2024-09-19 | 2024-09-20 | $243.92 | $238.25 | 6.44% | 2 | |
| 2024-09-17 | 2024-09-18 | $227.87 | $227.20 | 0.25% | 2 | |
| 2024-09-13 | 2024-09-16 | $230.29 | $226.78 | 0.01% | 2 | |
| 2024-09-11 | 2024-09-12 | $228.13 | $229.81 | 0.60% | 2 | |
| 2024-09-06 | 2024-09-09 | $210.73 | $216.27 | -7.77% | 2 | |
| 2024-08-26 | 2024-08-27 | $213.21 | $209.21 | -3.08% | 2 | |
| 2024-08-22 | 2024-08-23 | $210.66 | $220.32 | -5.26% | 2 | |
| 2024-08-20 | 2024-08-21 | $221.10 | $223.27 | -0.83% | 2 | |
| 2024-07-19 | 2024-07-22 | $239.20 | $251.51 | -3.80% | 2 | |
| 2024-07-17 | 2024-07-18 | $248.50 | $249.23 | -3.00% | 2 | |
| 2024-07-15 | 2024-07-16 | $252.64 | $256.56 | 1.42% | 2 | |
| 2024-07-11 | 2024-07-12 | $241.03 | $248.23 | -7.77% | 2 | |
| 2024-07-09 | 2024-07-10 | $262.33 | $263.26 | 3.16% | 2 | |
| 2024-07-05 | 2024-07-08 | $251.52 | $252.94 | 1.69% | 2 | |
| 2024-07-02 | 2024-07-03 | $231.26 | $246.39 | 8.99% | 2 | |
| 2024-06-28 | 2024-07-01 | $197.88 | $209.86 | 0.03% | 2 | |
| 2024-06-26 | 2024-06-27 | $196.37 | $197.42 | 4.15% | 2 | |
| 2024-06-24 | 2024-06-25 | $182.58 | $187.35 | -0.39% | 2 | |
| 2024-06-20 | 2024-06-21 | $181.57 | $183.01 | -1.78% | 2 | |
| 2024-06-17 | 2024-06-18 | $187.44 | $184.86 | 4.58% | 2 | |
| 2024-05-29 | 2024-05-30 | $176.19 | $178.79 | -0.46% | 2 | |
| 2023-07-06 | 2023-07-07 | $276.54 | $274.43 | -2.07% | 2 | |
| 2023-06-23 | 2023-06-26 | $256.60 | $241.05 | -2.90% | 2 | |
| 2023-06-21 | 2023-06-22 | $259.46 | $264.61 | -5.09% | 2 | |
| 2023-06-16 | 2023-06-20 | $260.54 | $274.45 | 1.45% | 2 | |
| 2023-06-14 | 2023-06-15 | $256.79 | $255.90 | -0.85% | 2 | |
| 2023-06-12 | 2023-06-13 | $249.83 | $258.71 | 1.82% | 2 | |
| 2023-06-08 | 2023-06-09 | $234.86 | $244.40 | 3.94% | 2 | |
| 2023-06-06 | 2023-06-07 | $221.31 | $224.57 | 1.35% | 2 | |
| 2023-06-02 | 2023-06-05 | $213.97 | $217.61 | 2.61% | 2 | |
| 2023-05-31 | 2023-06-01 | $203.93 | $207.52 | 1.06% | 2 | |
| 2023-04-05 | 2023-04-06 | $185.52 | $185.06 | -3.48% | 2 | |
| 2023-04-03 | 2023-04-04 | $194.77 | $192.58 | -5.68% | 2 | |
| 2023-03-30 | 2023-03-31 | $195.28 | $207.46 | 0.47% | 2 | |
| 2023-03-28 | 2023-03-29 | $189.19 | $193.88 | -1.41% | 2 | |
| 2023-03-24 | 2023-03-27 | $190.41 | $191.81 | -1.03% | 2 | |
| 2023-02-21 | 2023-02-22 | $197.37 | $200.86 | -4.90% | 2 | |
| 2023-02-16 | 2023-02-17 | $202.04 | $208.31 | -5.30% | 2 | |
| 2023-02-14 | 2023-02-15 | $209.25 | $214.24 | 6.57% | 2 | |
| 2023-02-10 | 2023-02-13 | $196.89 | $194.64 | -4.70% | 2 | |
| 2022-09-21 | 2022-09-22 | $300.80 | $288.59 | -2.49% | 2 | |
| 2022-09-19 | 2022-09-20 | $309.07 | $308.73 | 1.52% | 2 | |
| 2022-09-15 | 2022-09-16 | $303.75 | $303.35 | 0.16% | 2 | |
| 2022-09-13 | 2022-09-14 | $292.13 | $302.61 | -3.81% | 2 | |
| 2022-08-22 | 2022-08-23 | $289.91 | $296.45 | -2.23% | 2 | |
| 2022-08-18 | 2022-08-19 | $302.87 | $296.67 | -0.51% | 2 | |
| 2022-08-16 | 2022-08-17 | $306.56 | $304.00 | -0.98% | 2 | |
| 2022-08-10 | 2022-08-11 | $294.36 | $286.63 | 3.32% | 2 | |
| 2022-08-08 | 2022-08-09 | $290.42 | $283.33 | 0.52% | 2 |