LongTermTrend_V1121
ARCHIVEDhybridllmLoosened overfit thresholds and added structural risk/regime controls: lowered cumret and dist_sma_50 requirements and reduced ret_20d cut to capture more valid market states; added sma_50_slope > 0 to favor rising shorter-term trend; reduced rel_volume threshold to 1.5 for breakout signals. Replaced single noisy exit with a combined exit (macd_hist < 0 OR 5-day loss < 6%) to improve stop-loss behavior. Introduced regime gates to avoid entries in downtrends, very high volatility, or bubble states (allow only UPTREND/SIDEWAYS, LOW/MEDIUM_VOLATILITY, NORMAL bubble). Added volatility-based position sizing (vol_pctile) and lowered base position to 0.8 to reduce drawdown risk.
Lineage
changed sma_200_slope threshold -0.0024 -> -0.0003; changed cumret_252d threshold -0.1997 -> 0.2888
Strategy Logic (pseudocode)
# LongTermTrend_V1121 [hybrid]
require regime.trend in ['UPTREND', 'SIDEWAYS']
require regime.volatility in ['LOW_VOLATILITY', 'MEDIUM_VOLATILITY']
require regime.bubble in ['NORMAL']
if flat and ((((close > sma_200 and sma_200_slope > -0.0003) or ret_20d > 0.08) and ret_20d > 0.04 and cumret_252d > 0.15 and dist_sma_50 > -0.2 and sma_50_slope > 0.0) or ((macd_hist > 0.0 and close > sma_50 and sma_50_slope > 0.0) or (breakout_50 == 1 and rel_volume > 1.5) or ((macd_hist > 0.0 and close > sma_50) and sma_50 > sma_200))):
position = 0.8
if long and (macd_hist < 0.0 or ret_5d < -0.06):
position = 0.0 # exit to cashBacktest Metrics
| Metric | Train | Validation | Hidden Test | Full |
|---|---|---|---|---|
| CAGR | 0.7% | 4.9% | 4.1% | 2.4% |
| Total Return | 6.0% | 15.4% | 16.3% | 42.4% |
| Sharpe | 0.12 | 0.36 | 0.32 | 0.23 |
| Sortino | 0.07 | 0.24 | 0.22 | 0.15 |
| Calmar | 0.02 | 0.20 | 0.20 | 0.07 |
| Volatility | 13.8% | 17.1% | 17.2% | 15.5% |
| Max DD | -34.4% | -25.0% | -20.3% | -34.4% |
| Win Rate | 44.9% | 46.2% | 37.5% | 43.3% |
| Avg Win | 3.6% | 4.5% | 6.3% | 4.4% |
| Avg Loss | -2.6% | -2.5% | -2.7% | -2.6% |
| Payoff | 1.38 | 1.77 | 2.33 | 1.67 |
| Expectancy | 0.2% | 0.7% | 0.7% | 0.4% |
| Profit Factor | 1.12 | 1.52 | 1.40 | 1.28 |
| Trades | 69 | 26 | 32 | 127 |
| Avg Holding Days | 5.6 | 6.0 | 6.4 | 5.9 |
| Turnover | 13.8 | 13.9 | 13.7 | 13.8 |
| Exposure | 12.6% | 13.8% | 14.8% | 13.4% |
Growth of $100
Walk-Forward Years
| Year | CAGR | Sharpe | Max DD | Trades |
|---|---|---|---|---|
| 2016 | -3.2% | -0.28 | -11.7% | 8 |
| 2017 | 11.8% | 1.26 | -4.3% | 6 |
| 2018 | -8.5% | -1.12 | -9.9% | 4 |
| 2019 | 3.0% | 0.24 | -16.0% | 4 |
| 2020 | 0.0% | 0.00 | 0.0% | 0 |
| 2021 | 0.7% | 0.14 | -25.0% | 15 |
| 2022 | 3.5% | 0.29 | -16.8% | 10 |
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 | 277 | 0.0% | 0.00 | 0% |
| hidden test | EXPENSIVE | 83 | 34.2% | 2.44 | 2% |
| hidden test | EXTREME | 48 | 0.0% | 0.00 | 0% |
| hidden test | HIGH VOLATILITY | 254 | -13.9% | -1.09 | 1% |
| hidden test | LOW VOLATILITY | 436 | 17.4% | 1.01 | 22% |
| hidden test | MEDIUM VOLATILITY | 251 | 4.5% | 0.22 | 17% |
| hidden test | NORMAL | 810 | 2.9% | 0.16 | 17% |
| hidden test | SIDEWAYS | 293 | -20.6% | -1.00 | 27% |
| hidden test | UPTREND | 371 | 30.3% | 1.49 | 16% |
| train | DOWNTREND | 518 | -1.2% | -1.00 | 0% |
| train | EXPENSIVE | 311 | 10.3% | 1.83 | 2% |
| train | EXTREME | 100 | 0.0% | 0.00 | 0% |
| train | HIGH VOLATILITY | 699 | 5.1% | 0.37 | 1% |
| train | LOW VOLATILITY | 745 | 12.9% | 0.93 | 25% |
| train | MEDIUM VOLATILITY | 568 | -17.1% | -1.24 | 11% |
| train | NORMAL | 1,601 | 0.1% | 0.01 | 15% |
| train | SIDEWAYS | 592 | -7.2% | -0.49 | 16% |
| train | UPTREND | 902 | 9.1% | 0.54 | 17% |
| validation | DOWNTREND | 125 | 0.0% | 0.00 | 0% |
| validation | EXPENSIVE | 138 | 0.0% | 0.00 | 0% |
| validation | EXTREME | 144 | 0.0% | 0.00 | 0% |
| validation | HIGH VOLATILITY | 258 | 4.0% | 0.27 | 1% |
| validation | LOW VOLATILITY | 183 | 9.3% | 0.63 | 30% |
| validation | MEDIUM VOLATILITY | 315 | 6.3% | 0.31 | 15% |
| validation | NORMAL | 474 | 9.9% | 0.46 | 22% |
| validation | SIDEWAYS | 206 | -2.1% | -0.12 | 17% |
| validation | UPTREND | 425 | 12.1% | 0.62 | 16% |
Trades (full period)
| Entry | Exit | Entry Px | Exit Px | Return | Days | |
|---|---|---|---|---|---|---|
| 2026-07-01 | 2026-07-06 | $425.30 | $419.77 | -5.30% | 3 | |
| 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-27 | 2026-06-02 | $440.36 | $423.74 | -3.41% | 5 | |
| 2026-05-22 | 2026-05-26 | $426.01 | $433.59 | 1.40% | 2 | |
| 2026-05-20 | 2026-05-21 | $417.26 | $417.85 | 2.44% | 2 | |
| 2026-05-14 | 2026-05-19 | $443.30 | $404.11 | -6.52% | 4 | |
| 2025-12-04 | 2025-12-30 | $454.53 | $454.43 | 2.22% | 18 | |
| 2025-09-08 | 2025-09-15 | $346.40 | $410.04 | 10.06% | 6 | |
| 2025-09-04 | 2025-09-05 | $338.53 | $350.84 | 0.90% | 2 | |
| 2025-08-25 | 2025-09-03 | $346.60 | $334.09 | -2.65% | 7 | |
| 2025-07-21 | 2025-08-01 | $328.49 | $302.63 | -5.29% | 10 | |
| 2025-06-04 | 2025-06-05 | $332.05 | $284.70 | -3.00% | 2 | |
| 2025-06-02 | 2025-06-03 | $342.69 | $344.27 | -1.03% | 2 | |
| 2025-05-22 | 2025-05-28 | $341.04 | $356.90 | 6.58% | 4 | |
| 2024-09-23 | 2024-10-04 | $250.00 | $250.08 | 0.70% | 10 | |
| 2024-09-16 | 2024-09-20 | $226.78 | $238.25 | 4.58% | 5 | |
| 2024-09-06 | 2024-09-09 | $210.73 | $216.27 | -6.91% | 2 | |
| 2024-06-17 | 2024-07-12 | $187.44 | $248.23 | 27.57% | 18 | |
| 2024-05-29 | 2024-05-30 | $176.19 | $178.79 | -0.41% | 2 | |
| 2024-01-03 | 2024-01-04 | $238.45 | $237.93 | -3.37% | 2 | |
| 2023-12-15 | 2024-01-02 | $253.50 | $248.42 | -0.94% | 11 | |
| 2023-11-16 | 2023-12-14 | $233.59 | $251.05 | -1.28% | 20 | |
| 2023-10-06 | 2023-10-17 | $260.53 | $254.85 | -2.03% | 8 | |
| 2023-08-30 | 2023-09-22 | $256.90 | $244.88 | -0.48% | 17 | |
| 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-10 | 2023-07-11 | $269.61 | $269.79 | -1.56% | 2 | |
| 2023-07-05 | 2023-07-07 | $282.48 | $274.43 | -1.09% | 3 | |
| 2023-05-31 | 2023-06-27 | $203.93 | $250.21 | 15.56% | 19 | |
| 2023-03-24 | 2023-04-06 | $190.41 | $185.06 | -2.88% | 10 | |
| 2022-09-13 | 2022-09-23 | $292.13 | $275.33 | -4.29% | 9 | |
| 2022-08-24 | 2022-08-25 | $297.10 | $296.07 | 0.01% | 2 | |
| 2022-08-22 | 2022-08-23 | $289.91 | $296.45 | -1.98% | 2 | |
| 2022-08-15 | 2022-08-19 | $309.32 | $296.67 | 0.61% | 5 | |
| 2022-08-02 | 2022-08-12 | $300.59 | $300.03 | -2.97% | 9 | |
| 2022-04-19 | 2022-04-20 | $342.72 | $325.73 | 1.74% | 2 | |
| 2022-04-14 | 2022-04-18 | $328.33 | $334.76 | -3.08% | 2 | |
| 2022-04-12 | 2022-04-13 | $328.98 | $340.79 | 0.74% | 2 | |
| 2022-03-21 | 2022-04-11 | $307.05 | $325.31 | 10.49% | 16 | |
| 2022-01-12 | 2022-01-13 | $368.74 | $343.85 | 2.98% | 2 | |
| 2021-12-28 | 2022-01-04 | $362.82 | $383.20 | 7.63% | 6 | |
| 2021-12-09 | 2021-12-10 | $334.60 | $339.01 | -5.03% | 2 | |
| 2021-11-26 | 2021-11-29 | $360.64 | $379.00 | -2.60% | 2 | |
| 2021-11-23 | 2021-11-24 | $369.68 | $372.00 | -3.47% | 2 | |
| 2021-10-12 | 2021-11-10 | $268.57 | $355.98 | 23.06% | 22 | |
| 2021-10-08 | 2021-10-11 | $261.83 | $263.98 | -0.98% | 2 | |
| 2021-09-28 | 2021-10-07 | $259.19 | $264.54 | -1.03% | 8 | |
| 2021-09-24 | 2021-09-27 | $258.13 | $263.79 | 2.04% | 2 | |
| 2021-09-22 | 2021-09-23 | $250.65 | $251.21 | 1.20% | 2 | |
| 2021-08-31 | 2021-09-21 | $245.24 | $246.46 | -0.21% | 15 | |
| 2021-08-25 | 2021-08-26 | $237.07 | $233.72 | 0.15% | 2 | |
| 2021-08-23 | 2021-08-24 | $235.43 | $236.16 | 2.90% | 2 | |
| 2021-08-19 | 2021-08-20 | $224.49 | $226.75 | -1.96% | 2 | |
| 2021-08-02 | 2021-08-17 | $236.56 | $221.90 | -0.24% | 12 | |
| 2021-06-24 | 2021-07-12 | $226.61 | $228.57 | -0.08% | 12 | |
| 2021-04-14 | 2021-04-29 | $244.08 | $225.67 | -7.29% | 12 | |
| 2019-12-16 | 2019-12-17 | $25.43 | $25.27 | 4.99% | 2 | |
| 2019-10-16 | 2019-10-25 | $17.32 | $21.88 | 12.82% | 8 | |
| 2019-09-11 | 2019-09-25 | $16.47 | $15.25 | -4.29% | 11 | |
| 2019-07-22 | 2019-07-26 | $17.05 | $15.20 | -9.19% | 5 | |
| 2018-12-11 | 2018-12-18 | $24.45 | $22.47 | -3.81% | 6 | |
| 2018-12-06 | 2018-12-07 | $24.20 | $23.86 | 0.59% | 2 | |
| 2018-03-13 | 2018-03-15 | $22.79 | $21.71 | -4.53% | 3 | |
| 2018-01-18 | 2018-02-05 | $22.97 | $22.21 | -0.92% | 13 | |
| 2017-12-12 | 2017-12-26 | $22.74 | $21.15 | -1.04% | 10 | |
| 2017-10-12 | 2017-10-23 | $23.71 | $22.47 | -2.29% | 8 | |
| 2017-03-24 | 2017-03-28 | $17.54 | $18.50 | 4.67% | 3 | |
| 2017-03-20 | 2017-03-23 | $17.46 | $16.99 | -2.13% | 4 | |
| 2017-01-31 | 2017-02-02 | $16.80 | $16.77 | -0.60% | 3 | |
| 2016-12-28 | 2017-01-25 | $14.65 | $16.96 | 12.46% | 19 | |
| 2016-07-22 | 2016-08-09 | $14.82 | $15.27 | 1.91% | 13 | |
| 2016-06-08 | 2016-06-15 | $15.70 | $14.51 | -6.15% | 6 | |
| 2016-04-25 | 2016-04-26 | $16.79 | $16.92 | -0.77% | 2 | |
| 2016-04-19 | 2016-04-20 | $16.49 | $16.66 | -2.21% | 2 | |
| 2016-04-15 | 2016-04-18 | $16.97 | $16.93 | 0.68% | 2 | |
| 2016-04-04 | 2016-04-14 | $16.47 | $16.79 | 5.55% | 9 | |
| 2016-03-28 | 2016-04-01 | $15.35 | $15.84 | 0.55% | 5 | |
| 2015-12-29 | 2016-01-06 | $15.81 | $14.60 | -2.04% | 6 | |
| 2015-09-21 | 2015-09-30 | $17.61 | $16.56 | -4.45% | 8 | |
| 2015-07-20 | 2015-07-22 | $18.82 | $17.86 | -2.43% | 3 | |
| 2015-07-14 | 2015-07-15 | $17.71 | $17.54 | 0.90% | 2 | |
| 2015-06-22 | 2015-07-09 | $17.32 | $17.19 | -2.40% | 13 | |
| 2015-06-18 | 2015-06-19 | $17.46 | $17.50 | 0.29% | 2 | |
| 2015-06-09 | 2015-06-10 | $17.07 | $16.71 | -0.25% | 2 | |
| 2015-06-05 | 2015-06-08 | $16.61 | $17.09 | 0.89% | 2 | |
| 2015-06-03 | 2015-06-04 | $16.60 | $16.39 | 0.05% | 2 | |
| 2015-06-01 | 2015-06-02 | $16.63 | $16.56 | -0.59% | 2 | |
| 2015-05-28 | 2015-05-29 | $16.76 | $16.72 | 1.14% | 2 | |
| 2015-05-26 | 2015-05-27 | $16.50 | $16.50 | -0.25% | 2 | |
| 2015-04-28 | 2015-05-22 | $15.37 | $16.52 | 4.69% | 19 | |
| 2015-04-14 | 2015-04-21 | $13.83 | $13.96 | -1.88% | 6 | |
| 2014-11-25 | 2014-12-01 | $16.54 | $15.44 | -0.87% | 4 | |
| 2014-11-12 | 2014-11-24 | $16.61 | $16.45 | -2.78% | 9 | |
| 2014-10-08 | 2014-10-13 | $17.29 | $14.97 | -7.15% | 4 | |
| 2014-09-15 | 2014-09-16 | $16.92 | $17.38 | -7.41% | 2 | |
| 2014-09-02 | 2014-09-12 | $18.94 | $18.61 | 3.01% | 9 | |
| 2014-08-28 | 2014-08-29 | $17.59 | $17.98 | 0.03% | 2 | |
| 2014-08-26 | 2014-08-27 | $17.45 | $17.55 | -0.41% | 2 |