LongTermTrend_V1286
ARCHIVEDhybridllm1) Added conservative regime gates: allow only UPTREND/SIDEWAYS and exclude HIGH_VOL/EXTREME bubble to reduce regime overfit. 2) Simplified and consolidated entry: require price > sma_50 plus momentum/breakout or 20d return, and modest 252d cumulative filter to avoid weak regimes. 3) Replaced fragile tiny daily stop with robust multi-condition exit: larger 20d stop (-5%), close < sma_50, or negative macd_hist to reduce whipsaw. 4) Introduced position sizing rules: reduce size in high vol (vol_pctile>0.8), moderate size when vol spike (vol_chg>0.15), and full size on strong breakout with high rel_volume. 5) Lowered base_position to 0.7 to reduce leverage and overfitting risk.
Lineage
entry from LongTermTrend_V0959, exit from PriceMomentum_V1021
Strategy Logic (pseudocode)
# LongTermTrend_V1286 [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_50 and (macd_hist > 0.0 or ret_20d > 0.05 or (breakout_50 == 1 and rel_volume > 1.3)) and cumret_252d > 0.02):
position = 0.7
if long and (ret_20d < -0.05 or close < sma_50 or macd_hist < 0.0):
position = 0.0 # exit to cashBacktest Metrics
| Metric | Train | Validation | Hidden Test | Full |
|---|---|---|---|---|
| CAGR | -1.0% | 21.0% | -8.2% | 1.3% |
| Total Return | -7.5% | 77.1% | -27.3% | 21.6% |
| Sharpe | -0.01 | 1.12 | -0.61 | 0.16 |
| Sortino | -0.01 | 1.05 | -0.36 | 0.12 |
| Calmar | -0.03 | 0.99 | -0.26 | 0.03 |
| Volatility | 13.0% | 18.5% | 12.7% | 14.2% |
| Max DD | -32.7% | -21.2% | -31.9% | -42.7% |
| Win Rate | 37.0% | 49.0% | 30.8% | 38.8% |
| Avg Win | 3.2% | 4.8% | 2.7% | 3.8% |
| Avg Loss | -2.0% | -1.9% | -2.3% | -2.0% |
| Payoff | 1.61 | 2.47 | 1.17 | 1.84 |
| Expectancy | -0.1% | 1.4% | -0.8% | 0.2% |
| Profit Factor | 0.95 | 2.37 | 0.52 | 1.16 |
| Trades | 108 | 49 | 39 | 196 |
| Avg Holding Days | 4.5 | 4.9 | 4.7 | 4.7 |
| Turnover | 19.0 | 22.9 | 14.6 | 18.6 |
| Exposure | 13.6% | 17.9% | 10.8% | 13.8% |
Growth of $100
Walk-Forward Years
| Year | CAGR | Sharpe | Max DD | Trades |
|---|---|---|---|---|
| 2016 | -3.5% | -0.41 | -8.2% | 9 |
| 2017 | 7.0% | 0.55 | -8.9% | 25 |
| 2018 | -7.9% | -1.11 | -11.4% | 7 |
| 2019 | 1.9% | 0.32 | -4.9% | 1 |
| 2020 | 61.5% | 2.66 | -5.8% | 11 |
| 2021 | 14.1% | 0.71 | -17.9% | 25 |
| 2022 | -4.0% | -0.23 | -18.6% | 11 |
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 | -2.5% | -1.37 | 1% |
| hidden test | EXPENSIVE | 83 | 5.6% | 0.25 | 24% |
| hidden test | EXTREME | 48 | 0.0% | 0.00 | 0% |
| hidden test | HIGH VOLATILITY | 254 | -0.8% | -0.11 | 1% |
| hidden test | LOW VOLATILITY | 440 | 6.6% | 0.49 | 17% |
| hidden test | MEDIUM VOLATILITY | 250 | -40.0% | -2.59 | 10% |
| hidden test | NORMAL | 813 | -9.5% | -0.81 | 10% |
| hidden test | SIDEWAYS | 295 | -16.8% | -1.25 | 16% |
| hidden test | UPTREND | 371 | -4.4% | -0.27 | 14% |
| train | DOWNTREND | 518 | -2.9% | -1.10 | 1% |
| train | EXPENSIVE | 311 | 23.3% | 1.26 | 24% |
| train | EXTREME | 100 | 8.1% | 1.55 | 1% |
| train | HIGH VOLATILITY | 699 | 5.6% | 0.51 | 1% |
| train | LOW VOLATILITY | 745 | 8.7% | 0.64 | 24% |
| train | MEDIUM VOLATILITY | 568 | -18.7% | -1.29 | 15% |
| train | NORMAL | 1,601 | -5.2% | -0.43 | 12% |
| train | SIDEWAYS | 592 | -4.1% | -0.36 | 13% |
| train | UPTREND | 902 | 4.1% | 0.24 | 21% |
| validation | DOWNTREND | 125 | 0.0% | 0.00 | 0% |
| validation | EXPENSIVE | 138 | 86.4% | 3.38 | 29% |
| validation | EXTREME | 144 | 33.0% | 2.61 | 2% |
| validation | HIGH VOLATILITY | 258 | -8.3% | -1.00 | 0% |
| validation | LOW VOLATILITY | 183 | 1.3% | 0.09 | 31% |
| validation | MEDIUM VOLATILITY | 315 | 55.9% | 2.22 | 25% |
| validation | NORMAL | 474 | -2.1% | -0.12 | 19% |
| validation | SIDEWAYS | 206 | -13.5% | -0.86 | 17% |
| validation | UPTREND | 425 | 43.5% | 1.98 | 23% |
Trades (full period)
| Entry | Exit | Entry Px | Exit Px | Return | Days | |
|---|---|---|---|---|---|---|
| 2026-07-01 | 2026-07-06 | $425.30 | $419.77 | -4.63% | 3 | |
| 2026-06-03 | 2026-06-04 | $423.70 | $418.45 | -0.15% | 2 | |
| 2026-05-27 | 2026-06-02 | $440.36 | $423.74 | -2.99% | 5 | |
| 2026-05-22 | 2026-05-26 | $426.01 | $433.59 | 1.23% | 2 | |
| 2026-05-08 | 2026-05-21 | $428.35 | $417.85 | 0.88% | 10 | |
| 2026-04-20 | 2026-04-21 | $392.50 | $386.42 | -1.56% | 2 | |
| 2025-12-04 | 2025-12-30 | $454.53 | $454.43 | 1.98% | 18 | |
| 2025-11-06 | 2025-11-07 | $445.91 | $429.52 | -2.59% | 2 | |
| 2025-11-03 | 2025-11-05 | $468.37 | $462.07 | -1.99% | 3 | |
| 2025-10-24 | 2025-10-27 | $433.72 | $452.42 | -2.52% | 2 | |
| 2025-10-14 | 2025-10-15 | $429.24 | $435.15 | -1.21% | 2 | |
| 2025-10-09 | 2025-10-10 | $435.54 | $413.49 | -0.64% | 2 | |
| 2025-10-07 | 2025-10-08 | $433.09 | $438.69 | -3.25% | 2 | |
| 2025-09-08 | 2025-10-06 | $346.40 | $453.25 | 15.37% | 21 | |
| 2025-09-04 | 2025-09-05 | $338.53 | $350.84 | 0.79% | 2 | |
| 2025-08-25 | 2025-09-03 | $346.60 | $334.09 | -2.32% | 7 | |
| 2025-08-11 | 2025-08-21 | $339.03 | $320.11 | -1.34% | 9 | |
| 2025-07-29 | 2025-07-30 | $321.20 | $319.04 | -1.08% | 2 | |
| 2025-07-21 | 2025-07-25 | $328.49 | $316.06 | -5.29% | 5 | |
| 2025-06-04 | 2025-06-05 | $332.05 | $284.70 | -2.62% | 2 | |
| 2025-05-19 | 2025-06-03 | $342.09 | $344.27 | -1.52% | 11 | |
| 2025-05-12 | 2025-05-13 | $318.38 | $334.07 | 4.58% | 2 | |
| 2024-09-25 | 2024-10-04 | $257.02 | $250.08 | -3.88% | 8 | |
| 2023-12-15 | 2024-01-02 | $253.50 | $248.42 | -0.80% | 11 | |
| 2023-11-29 | 2023-12-14 | $244.14 | $251.05 | -2.24% | 12 | |
| 2023-11-22 | 2023-11-24 | $234.21 | $235.45 | -2.17% | 2 | |
| 2023-11-16 | 2023-11-17 | $233.59 | $234.30 | -2.80% | 2 | |
| 2023-10-16 | 2023-10-17 | $253.92 | $254.85 | 0.64% | 2 | |
| 2023-10-11 | 2023-10-13 | $262.99 | $251.12 | -1.40% | 3 | |
| 2023-10-06 | 2023-10-10 | $260.53 | $263.62 | -0.24% | 3 | |
| 2023-07-20 | 2023-07-21 | $262.90 | $260.02 | -6.95% | 2 | |
| 2023-07-18 | 2023-07-19 | $293.34 | $291.26 | 0.57% | 2 | |
| 2023-07-14 | 2023-07-17 | $281.38 | $290.38 | 0.74% | 2 | |
| 2023-07-12 | 2023-07-13 | $271.99 | $277.90 | 0.43% | 2 | |
| 2023-07-10 | 2023-07-11 | $269.61 | $269.79 | -1.37% | 2 | |
| 2023-07-06 | 2023-07-07 | $276.54 | $274.43 | -1.61% | 2 | |
| 2023-07-03 | 2023-07-05 | $279.82 | $282.48 | 4.68% | 2 | |
| 2023-06-29 | 2023-06-30 | $257.50 | $261.77 | 0.20% | 2 | |
| 2023-06-13 | 2023-06-27 | $258.71 | $250.21 | -2.48% | 10 | |
| 2022-09-15 | 2022-09-23 | $303.75 | $275.33 | -3.37% | 7 | |
| 2022-09-13 | 2022-09-14 | $292.13 | $302.61 | -2.96% | 2 | |
| 2022-08-26 | 2022-08-29 | $288.09 | $284.82 | -2.03% | 2 | |
| 2022-08-24 | 2022-08-25 | $297.10 | $296.07 | 0.01% | 2 | |
| 2022-08-22 | 2022-08-23 | $289.91 | $296.45 | -1.73% | 2 | |
| 2022-08-15 | 2022-08-19 | $309.32 | $296.67 | 0.53% | 5 | |
| 2022-08-02 | 2022-08-12 | $300.59 | $300.03 | -2.57% | 9 | |
| 2022-04-19 | 2022-04-20 | $342.72 | $325.73 | 1.52% | 2 | |
| 2022-04-14 | 2022-04-18 | $328.33 | $334.76 | -2.70% | 2 | |
| 2022-04-12 | 2022-04-13 | $328.98 | $340.79 | 0.65% | 2 | |
| 2022-03-21 | 2022-04-11 | $307.05 | $325.31 | 9.20% | 16 | |
| 2021-12-31 | 2022-01-03 | $352.26 | $399.93 | -1.03% | 2 | |
| 2021-12-28 | 2021-12-30 | $362.82 | $356.78 | -0.64% | 3 | |
| 2021-11-26 | 2021-11-29 | $360.64 | $379.00 | -2.28% | 2 | |
| 2021-11-23 | 2021-11-24 | $369.68 | $372.00 | -3.03% | 2 | |
| 2021-10-12 | 2021-11-10 | $268.57 | $355.98 | 20.11% | 22 | |
| 2021-10-08 | 2021-10-11 | $261.83 | $263.98 | -0.86% | 2 | |
| 2021-09-27 | 2021-10-07 | $263.79 | $264.54 | 0.62% | 9 | |
| 2021-09-23 | 2021-09-24 | $251.21 | $258.13 | 0.02% | 2 | |
| 2021-08-31 | 2021-09-21 | $245.24 | $246.46 | -0.18% | 15 | |
| 2021-08-25 | 2021-08-26 | $237.07 | $233.72 | 0.13% | 2 | |
| 2021-08-23 | 2021-08-24 | $235.43 | $236.16 | 2.54% | 2 | |
| 2021-08-19 | 2021-08-20 | $224.49 | $226.75 | -1.72% | 2 | |
| 2021-08-02 | 2021-08-17 | $236.56 | $221.90 | -0.20% | 12 | |
| 2021-07-21 | 2021-07-22 | $218.43 | $216.42 | -0.69% | 2 | |
| 2021-07-16 | 2021-07-19 | $214.74 | $215.41 | -0.83% | 2 | |
| 2021-07-13 | 2021-07-15 | $222.85 | $216.87 | -3.45% | 3 | |
| 2021-06-24 | 2021-07-12 | $226.61 | $228.57 | -0.06% | 12 | |
| 2021-05-03 | 2021-05-04 | $228.30 | $224.53 | -2.56% | 2 | |
| 2021-04-14 | 2021-04-29 | $244.08 | $225.67 | -6.38% | 12 | |
| 2021-02-05 | 2021-02-08 | $284.08 | $287.81 | 0.04% | 2 | |
| 2021-02-03 | 2021-02-04 | $284.90 | $283.33 | -1.59% | 2 | |
| 2021-02-01 | 2021-02-02 | $279.94 | $290.93 | 3.94% | 2 | |
| 2021-01-28 | 2021-01-29 | $278.48 | $264.51 | -2.47% | 2 | |
| 2021-01-26 | 2021-01-27 | $294.36 | $288.05 | 0.04% | 2 | |
| 2021-01-12 | 2021-01-25 | $283.15 | $293.60 | 2.93% | 9 | |
| 2021-01-05 | 2021-01-11 | $245.04 | $270.40 | 13.99% | 5 | |
| 2020-12-31 | 2021-01-04 | $235.22 | $243.26 | 0.96% | 2 | |
| 2020-12-29 | 2020-12-30 | $222.00 | $231.59 | 0.10% | 2 | |
| 2020-12-24 | 2020-12-28 | $220.59 | $221.23 | 1.57% | 2 | |
| 2020-12-18 | 2020-12-23 | $231.67 | $215.33 | -1.72% | 4 | |
| 2020-12-10 | 2020-12-17 | $209.02 | $218.63 | 2.02% | 6 | |
| 2020-11-18 | 2020-12-08 | $162.21 | $216.63 | 30.13% | 14 | |
| 2020-11-09 | 2020-11-10 | $140.42 | $136.79 | -1.55% | 2 | |
| 2020-10-22 | 2020-10-23 | $141.93 | $140.21 | 0.38% | 2 | |
| 2020-10-13 | 2020-10-20 | $148.88 | $140.65 | -1.93% | 6 | |
| 2020-06-29 | 2020-06-30 | $67.29 | $71.99 | 3.48% | 2 | |
| 2020-06-25 | 2020-06-26 | $65.73 | $63.98 | 1.69% | 2 | |
| 2019-12-17 | 2020-01-22 | $25.27 | $37.97 | 28.90% | 24 | |
| 2019-11-22 | 2019-11-25 | $22.20 | $22.42 | -4.44% | 2 | |
| 2018-12-11 | 2018-12-18 | $24.45 | $22.47 | -3.32% | 6 | |
| 2018-12-07 | 2018-12-10 | $23.86 | $24.34 | -1.12% | 2 | |
| 2018-12-04 | 2018-12-06 | $23.98 | $24.20 | 0.10% | 2 | |
| 2018-11-29 | 2018-11-30 | $22.74 | $23.37 | -1.49% | 2 | |
| 2018-03-13 | 2018-03-15 | $22.79 | $21.71 | -3.97% | 3 | |
| 2018-02-06 | 2018-02-07 | $22.26 | $23.00 | 0.04% | 2 | |
| 2018-01-11 | 2018-02-05 | $22.53 | $22.21 | 1.76% | 17 | |
| 2017-12-12 | 2017-12-26 | $22.74 | $21.15 | -0.90% | 10 | |
| 2017-10-18 | 2017-10-20 | $23.98 | $23.01 | -0.91% | 3 | |
| 2017-10-16 | 2017-10-17 | $23.37 | $23.72 | -1.12% | 2 | |
| 2017-10-12 | 2017-10-13 | $23.71 | $23.70 | 0.07% | 2 |