LongTermTrend_V1204
ARCHIVEDhybridllm1) Added regime gates: restrict to UPTREND and non-HIGH volatility, avoid EXTREME bubble to reduce overfitting and avoid trading in bad regimes. 2) Simplified and consolidated entry logic: require one of (price > sma_200 with non-negative long-term slope, strong 20d return, or breakout_50 with elevated rel_volume) plus positive 252d cumulative return, positive sma_50 slope and moderate volatility (vol_pctile < 0.8). This keeps momentum/breakout signals but adds trend and volatility confirmation. 3) Improved exits: added trend-failure exit (close < sma_50), a harder 20d stop (-3%) and a quicker exit when macd_hist turns negative combined with small negative 20d return. 4) Reduced base_position from 1.0 to 0.6 to lower portfolio-level risk and drawdowns.
Lineage
entry from LongTermTrend_V0521, exit from PriceMomentum_V0817
Strategy Logic (pseudocode)
# LongTermTrend_V1204 [hybrid]
require regime.trend in ['UPTREND']
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.06 or (breakout_50 == 1 and rel_volume > 1.3)) and cumret_252d > 0.02 and sma_50_slope > 0.0 and vol_pctile < 0.8):
position = 0.6
if long and (close < sma_50 or ret_20d < -0.03 or (macd_hist < 0.0 and ret_20d < -0.01)):
position = 0.0 # exit to cashBacktest Metrics
| Metric | Train | Validation | Hidden Test | Full |
|---|---|---|---|---|
| CAGR | 2.2% | 19.4% | -6.4% | 3.3% |
| Total Return | 19.3% | 70.4% | -22.0% | 61.3% |
| Sharpe | 0.23 | 1.08 | -0.49 | 0.30 |
| Sortino | 0.16 | 0.99 | -0.27 | 0.22 |
| Calmar | 0.09 | 0.74 | -0.21 | 0.08 |
| Volatility | 13.1% | 18.0% | 12.1% | 14.0% |
| Max DD | -24.4% | -26.1% | -30.6% | -43.4% |
| Win Rate | 44.6% | 42.9% | 37.8% | 42.8% |
| Avg Win | 2.7% | 6.9% | 1.8% | 3.7% |
| Avg Loss | -1.9% | -2.5% | -2.1% | -2.1% |
| Payoff | 1.40 | 2.73 | 0.85 | 1.76 |
| Expectancy | 0.1% | 1.5% | -0.6% | 0.4% |
| Profit Factor | 1.12 | 2.05 | 0.52 | 1.32 |
| Trades | 101 | 42 | 37 | 180 |
| Avg Holding Days | 5.3 | 5.8 | 4.8 | 5.5 |
| Turnover | 15.3 | 16.8 | 11.9 | 14.7 |
| Exposure | 13.8% | 15.9% | 8.9% | 13.0% |
Growth of $100
Walk-Forward Years
| Year | CAGR | Sharpe | Max DD | Trades |
|---|---|---|---|---|
| 2016 | -2.0% | -0.35 | -6.1% | 2 |
| 2017 | 13.8% | 0.94 | -11.8% | 25 |
| 2018 | -10.3% | -1.37 | -10.3% | 3 |
| 2019 | 10.5% | 1.36 | -4.5% | 0 |
| 2020 | 43.9% | 2.25 | -9.6% | 10 |
| 2021 | 36.4% | 1.40 | -17.1% | 24 |
| 2022 | -15.1% | -1.68 | -16.9% | 7 |
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 | 278 | 0.0% | 0.00 | 0% |
| hidden test | EXPENSIVE | 83 | 27.8% | 1.13 | 37% |
| hidden test | EXTREME | 48 | 0.0% | 0.00 | 0% |
| hidden test | HIGH VOLATILITY | 254 | -13.1% | -1.37 | 0% |
| hidden test | LOW VOLATILITY | 438 | 6.8% | 0.68 | 10% |
| hidden test | MEDIUM VOLATILITY | 250 | -20.9% | -1.26 | 15% |
| hidden test | NORMAL | 811 | -9.7% | -0.94 | 7% |
| hidden test | SIDEWAYS | 293 | -21.5% | -2.00 | 2% |
| hidden test | UPTREND | 371 | 2.0% | 0.12 | 21% |
| train | DOWNTREND | 518 | 0.0% | 0.00 | 0% |
| train | EXPENSIVE | 311 | 24.9% | 1.15 | 28% |
| train | EXTREME | 100 | 7.0% | 1.55 | 1% |
| train | HIGH VOLATILITY | 699 | 0.4% | 0.03 | 1% |
| train | LOW VOLATILITY | 745 | 15.9% | 1.23 | 24% |
| train | MEDIUM VOLATILITY | 568 | -10.4% | -0.69 | 16% |
| train | NORMAL | 1,601 | -1.4% | -0.13 | 12% |
| train | SIDEWAYS | 592 | -7.6% | -1.61 | 1% |
| train | UPTREND | 902 | 11.8% | 0.62 | 30% |
| validation | DOWNTREND | 125 | 0.0% | 0.00 | 0% |
| validation | EXPENSIVE | 138 | 62.8% | 2.58 | 36% |
| validation | EXTREME | 144 | 31.9% | 2.85 | 2% |
| validation | HIGH VOLATILITY | 258 | 6.3% | 0.46 | 1% |
| validation | LOW VOLATILITY | 183 | 6.0% | 0.44 | 26% |
| validation | MEDIUM VOLATILITY | 315 | 37.8% | 1.67 | 23% |
| validation | NORMAL | 474 | 2.9% | 0.17 | 14% |
| validation | SIDEWAYS | 206 | -9.0% | -1.67 | 1% |
| validation | UPTREND | 425 | 38.8% | 1.64 | 28% |
Trades (full period)
| Entry | Exit | Entry Px | Exit Px | Return | Days | |
|---|---|---|---|---|---|---|
| 2026-07-01 | 2026-07-06 | $425.30 | $419.77 | -3.97% | 3 | |
| 2026-05-29 | 2026-06-01 | $435.79 | $415.88 | -0.98% | 2 | |
| 2026-02-13 | 2026-02-17 | $417.44 | $410.63 | -0.07% | 2 | |
| 2026-02-11 | 2026-02-12 | $428.27 | $417.07 | 0.31% | 2 | |
| 2026-02-09 | 2026-02-10 | $417.32 | $425.21 | 0.79% | 2 | |
| 2026-02-04 | 2026-02-05 | $406.01 | $397.21 | -2.39% | 2 | |
| 2026-02-02 | 2026-02-03 | $421.81 | $421.96 | -1.32% | 2 | |
| 2026-01-12 | 2026-01-13 | $448.96 | $447.20 | 0.41% | 2 | |
| 2026-01-08 | 2026-01-09 | $435.80 | $445.01 | 0.49% | 2 | |
| 2026-01-06 | 2026-01-07 | $432.96 | $431.41 | -2.60% | 2 | |
| 2025-12-03 | 2026-01-05 | $446.74 | $451.67 | 1.26% | 22 | |
| 2025-12-01 | 2025-12-02 | $430.14 | $429.24 | -0.12% | 2 | |
| 2025-11-26 | 2025-11-28 | $426.58 | $430.17 | 0.91% | 2 | |
| 2025-11-24 | 2025-11-25 | $417.78 | $419.40 | 3.97% | 2 | |
| 2025-11-20 | 2025-11-21 | $395.23 | $391.09 | -1.42% | 2 | |
| 2025-11-18 | 2025-11-19 | $401.25 | $403.99 | -1.24% | 2 | |
| 2025-11-14 | 2025-11-17 | $404.35 | $408.92 | 0.23% | 2 | |
| 2025-10-28 | 2025-11-13 | $460.55 | $401.99 | -2.88% | 13 | |
| 2025-09-12 | 2025-10-27 | $395.94 | $452.42 | 10.51% | 32 | |
| 2025-09-04 | 2025-09-05 | $338.53 | $350.84 | 0.68% | 2 | |
| 2025-07-31 | 2025-08-01 | $308.27 | $302.63 | -2.14% | 2 | |
| 2025-07-29 | 2025-07-30 | $321.20 | $319.04 | -0.93% | 2 | |
| 2025-07-24 | 2025-07-25 | $305.30 | $316.06 | -5.04% | 2 | |
| 2025-07-21 | 2025-07-23 | $328.49 | $332.56 | 0.33% | 3 | |
| 2025-07-17 | 2025-07-18 | $319.41 | $329.65 | -0.54% | 2 | |
| 2025-07-15 | 2025-07-16 | $310.78 | $321.67 | -1.28% | 2 | |
| 2025-05-22 | 2025-06-06 | $341.04 | $295.14 | -9.00% | 11 | |
| 2025-02-21 | 2025-02-24 | $337.80 | $330.53 | -2.93% | 2 | |
| 2025-02-19 | 2025-02-20 | $360.56 | $354.40 | 0.97% | 2 | |
| 2025-02-14 | 2025-02-18 | $355.84 | $354.11 | -0.14% | 2 | |
| 2025-02-12 | 2025-02-13 | $336.51 | $355.94 | 1.34% | 2 | |
| 2025-02-10 | 2025-02-11 | $350.73 | $328.50 | -1.93% | 2 | |
| 2025-02-06 | 2025-02-07 | $374.32 | $361.62 | -0.73% | 2 | |
| 2024-10-23 | 2024-10-24 | $213.65 | $260.48 | -1.31% | 2 | |
| 2024-01-11 | 2024-01-12 | $227.22 | $218.89 | -1.84% | 2 | |
| 2024-01-03 | 2024-01-10 | $238.45 | $233.94 | -3.38% | 6 | |
| 2023-06-13 | 2023-07-24 | $258.71 | $269.06 | 2.71% | 28 | |
| 2022-09-21 | 2022-09-23 | $300.80 | $275.33 | -4.06% | 3 | |
| 2022-08-16 | 2022-08-22 | $306.56 | $289.91 | -2.59% | 5 | |
| 2022-08-05 | 2022-08-08 | $288.17 | $290.42 | -4.10% | 2 | |
| 2022-05-04 | 2022-05-05 | $317.54 | $291.09 | 2.74% | 2 | |
| 2022-04-22 | 2022-04-26 | $335.02 | $292.14 | -0.76% | 3 | |
| 2022-04-05 | 2022-04-21 | $363.75 | $336.26 | -9.05% | 12 | |
| 2022-01-12 | 2022-01-13 | $368.74 | $343.85 | 2.24% | 2 | |
| 2021-12-30 | 2022-01-03 | $356.78 | $399.93 | -1.75% | 3 | |
| 2021-12-28 | 2021-12-29 | $362.82 | $362.06 | -0.42% | 2 | |
| 2021-12-23 | 2021-12-27 | $355.67 | $364.65 | 3.34% | 2 | |
| 2021-12-21 | 2021-12-22 | $312.84 | $336.29 | 2.45% | 2 | |
| 2021-12-17 | 2021-12-20 | $310.86 | $299.98 | 0.25% | 2 | |
| 2021-12-15 | 2021-12-16 | $325.33 | $308.97 | 0.97% | 2 | |
| 2021-12-13 | 2021-12-14 | $322.14 | $319.50 | -3.10% | 2 | |
| 2021-12-08 | 2021-12-10 | $356.32 | $339.01 | -2.83% | 3 | |
| 2021-12-06 | 2021-12-07 | $336.34 | $350.58 | -0.47% | 2 | |
| 2021-12-02 | 2021-12-03 | $361.53 | $338.32 | -0.69% | 2 | |
| 2021-11-23 | 2021-12-01 | $369.68 | $365.00 | -0.69% | 6 | |
| 2021-08-24 | 2021-11-10 | $236.16 | $355.98 | 25.61% | 56 | |
| 2021-08-05 | 2021-08-23 | $238.21 | $235.43 | -2.66% | 13 | |
| 2021-03-09 | 2021-03-10 | $224.53 | $222.69 | 11.66% | 2 | |
| 2021-03-05 | 2021-03-08 | $199.32 | $187.67 | -2.39% | 2 | |
| 2021-03-03 | 2021-03-04 | $217.73 | $207.15 | -3.02% | 2 | |
| 2021-03-01 | 2021-03-02 | $239.48 | $228.81 | 3.69% | 2 | |
| 2021-02-25 | 2021-02-26 | $227.41 | $225.17 | -4.95% | 2 | |
| 2021-02-23 | 2021-02-24 | $232.95 | $247.34 | -1.43% | 2 | |
| 2021-02-19 | 2021-02-22 | $260.43 | $238.17 | -0.58% | 2 | |
| 2021-02-17 | 2021-02-18 | $266.05 | $262.46 | 0.03% | 2 | |
| 2021-02-12 | 2021-02-16 | $272.04 | $265.41 | 0.21% | 2 | |
| 2021-02-10 | 2021-02-11 | $268.27 | $270.55 | -3.27% | 2 | |
| 2021-01-12 | 2021-02-09 | $283.15 | $283.15 | 3.87% | 20 | |
| 2020-12-10 | 2021-01-11 | $209.02 | $270.40 | 25.60% | 21 | |
| 2020-11-19 | 2020-12-08 | $166.42 | $216.63 | 18.20% | 13 | |
| 2020-11-06 | 2020-11-10 | $143.32 | $136.79 | -2.43% | 3 | |
| 2020-11-03 | 2020-11-05 | $141.30 | $146.03 | 2.95% | 3 | |
| 2020-10-30 | 2020-11-02 | $129.35 | $133.50 | -3.45% | 2 | |
| 2020-10-21 | 2020-10-29 | $140.88 | $136.94 | -2.37% | 7 | |
| 2020-10-13 | 2020-10-20 | $148.88 | $140.65 | -1.65% | 6 | |
| 2020-08-11 | 2020-08-12 | $91.63 | $103.65 | -1.99% | 2 | |
| 2020-06-25 | 2020-06-30 | $65.73 | $71.99 | 2.92% | 4 | |
| 2020-05-29 | 2020-06-01 | $55.67 | $59.87 | 2.05% | 2 | |
| 2019-11-22 | 2020-01-22 | $22.20 | $37.97 | 30.11% | 40 | |
| 2018-11-27 | 2018-12-19 | $22.93 | $22.20 | -1.59% | 16 | |
| 2018-02-08 | 2018-02-09 | $21.02 | $20.69 | -5.29% | 2 | |
| 2018-02-01 | 2018-02-06 | $23.28 | $22.26 | -3.73% | 4 | |
| 2017-10-23 | 2017-10-24 | $22.47 | $22.49 | -1.52% | 2 | |
| 2017-10-19 | 2017-10-20 | $23.45 | $23.01 | -1.43% | 2 | |
| 2017-10-17 | 2017-10-18 | $23.72 | $23.98 | 0.76% | 2 | |
| 2017-10-13 | 2017-10-16 | $23.70 | $23.37 | -0.14% | 2 | |
| 2017-10-11 | 2017-10-12 | $23.64 | $23.71 | -0.29% | 2 | |
| 2017-10-05 | 2017-10-10 | $23.69 | $23.71 | -2.15% | 4 | |
| 2017-10-03 | 2017-10-04 | $23.21 | $23.67 | 1.04% | 2 | |
| 2017-09-29 | 2017-10-02 | $22.74 | $22.77 | 0.14% | 2 | |
| 2017-09-27 | 2017-09-28 | $22.73 | $22.64 | -0.86% | 2 | |
| 2017-09-18 | 2017-09-26 | $25.67 | $23.02 | -5.68% | 7 | |
| 2017-08-22 | 2017-08-23 | $22.76 | $23.52 | 0.50% | 2 | |
| 2017-08-15 | 2017-08-18 | $24.16 | $23.16 | -2.08% | 4 | |
| 2017-08-03 | 2017-08-07 | $23.14 | $23.68 | 5.54% | 3 | |
| 2017-06-30 | 2017-07-06 | $24.11 | $20.59 | -5.75% | 4 | |
| 2017-06-05 | 2017-06-14 | $23.15 | $25.38 | 6.18% | 8 | |
| 2017-05-12 | 2017-05-19 | $21.65 | $20.72 | -1.96% | 6 | |
| 2017-04-24 | 2017-05-10 | $20.54 | $21.68 | 3.03% | 13 | |
| 2017-04-20 | 2017-04-21 | $20.17 | $20.37 | -0.71% | 2 |