LongTermTrend_V0606
ARCHIVEDhybridllmSimplified and regularized entry: require price > SMA50 plus either SMA50>200 or positive 200-day slope to enforce trend; require momentum confirmation (MACD histogram >0, 20d return >3%, 50-day breakout, or elevated relative volume). Kept short-term confirmation with price > SMA20. Exit broadened to include MACD flip OR a hard drawdown stop (15%) OR extreme volatility (vol_pctile>0.9) to limit large losses. Added regime gates to avoid downtrends, high volatility, and bubble states (trade only in UPTREND/SIDEWAYS, LOW/MEDIUM vol, NORMAL bubble). Added volatility-based position sizing (scale down in high vol, full size in low vol, medium size otherwise) to reduce risk and improve out-of-sample robustness.
Lineage
added entry filter: sma_20 < close; added entry filter: macd_hist > -2.6055
Strategy Logic (pseudocode)
# LongTermTrend_V0606 [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_50 and (sma_50 > sma_200 or sma_200_slope > 0.0)) and (macd_hist > 0.0 or ret_20d > 0.03 or breakout_50 == 1 or rel_volume > 1.2) and sma_20 < close):
position = 1.0
if long and (macd_hist < 0.0 or drawdown > 0.15 or vol_pctile > 0.9):
position = 0.0 # exit to cashBacktest Metrics
| Metric | Train | Validation | Hidden Test | Full |
|---|---|---|---|---|
| CAGR | -5.4% | 8.5% | -8.1% | -3.4% |
| Total Return | -36.0% | 27.9% | -26.9% | -40.2% |
| Sharpe | -0.26 | 0.50 | -0.35 | -0.11 |
| Sortino | -0.15 | 0.32 | -0.21 | -0.06 |
| Calmar | -0.10 | 0.40 | -0.24 | -0.06 |
| Volatility | 16.2% | 20.3% | 19.1% | 17.9% |
| Max DD | -55.7% | -21.3% | -33.5% | -60.3% |
| Win Rate | 37.5% | 50.0% | 39.4% | 39.8% |
| Avg Win | 3.9% | 7.0% | 3.8% | 4.5% |
| Avg Loss | -3.2% | -3.6% | -3.8% | -3.4% |
| Payoff | 1.24 | 1.96 | 1.00 | 1.31 |
| Expectancy | -0.5% | 1.7% | -0.8% | -0.3% |
| Profit Factor | 0.75 | 1.96 | 0.65 | 0.87 |
| Trades | 72 | 18 | 33 | 123 |
| Avg Holding Days | 5.1 | 7.5 | 5.6 | 5.6 |
| Turnover | 18.0 | 12.0 | 17.8 | 16.8 |
| Exposure | 14.7% | 15.5% | 16.2% | 15.2% |
Growth of $100
Walk-Forward Years
| Year | CAGR | Sharpe | Max DD | Trades |
|---|---|---|---|---|
| 2016 | -7.1% | -0.84 | -8.7% | 3 |
| 2017 | 12.6% | 1.08 | -6.6% | 7 |
| 2018 | -19.8% | -1.57 | -24.0% | 8 |
| 2019 | -10.2% | -0.81 | -15.9% | 5 |
| 2020 | 0.0% | 0.00 | 0.0% | 0 |
| 2021 | 6.4% | 0.36 | -21.3% | 14 |
| 2022 | 6.0% | 0.42 | -17.6% | 3 |
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 | 269 | -3.6% | -1.40 | 1% |
| hidden test | EXPENSIVE | 83 | 42.8% | 2.44 | 2% |
| hidden test | EXTREME | 48 | 0.0% | 0.00 | 0% |
| hidden test | HIGH VOLATILITY | 254 | -2.4% | -0.16 | 2% |
| hidden test | LOW VOLATILITY | 429 | -3.6% | -0.19 | 24% |
| hidden test | MEDIUM VOLATILITY | 250 | -16.0% | -0.69 | 18% |
| hidden test | NORMAL | 802 | -12.1% | -0.61 | 19% |
| hidden test | SIDEWAYS | 293 | -17.5% | -0.71 | 31% |
| hidden test | UPTREND | 371 | -0.2% | -0.01 | 16% |
| train | DOWNTREND | 518 | -5.0% | -0.87 | 0% |
| train | EXPENSIVE | 311 | 13.0% | 1.82 | 2% |
| train | EXTREME | 100 | 0.0% | 0.00 | 0% |
| train | HIGH VOLATILITY | 699 | -1.6% | -0.12 | 1% |
| train | LOW VOLATILITY | 745 | 8.6% | 0.49 | 28% |
| train | MEDIUM VOLATILITY | 568 | -24.5% | -1.38 | 14% |
| train | NORMAL | 1,601 | -7.9% | -0.44 | 18% |
| train | SIDEWAYS | 592 | -6.7% | -0.38 | 18% |
| train | UPTREND | 902 | -2.3% | -0.12 | 21% |
| 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 | 1.3% | 0.07 | 1% |
| validation | LOW VOLATILITY | 183 | 13.8% | 0.84 | 34% |
| validation | MEDIUM VOLATILITY | 315 | 15.4% | 0.64 | 17% |
| validation | NORMAL | 474 | 16.3% | 0.64 | 25% |
| validation | SIDEWAYS | 206 | 2.3% | 0.11 | 20% |
| validation | UPTREND | 425 | 17.1% | 0.74 | 18% |
Trades (full period)
| Entry | Exit | Entry Px | Exit Px | Return | Days | |
|---|---|---|---|---|---|---|
| 2026-06-30 | 2026-07-06 | $420.60 | $419.77 | -4.65% | 4 | |
| 2026-05-27 | 2026-06-02 | $440.36 | $423.74 | -4.27% | 5 | |
| 2026-05-22 | 2026-05-26 | $426.01 | $433.59 | 1.75% | 2 | |
| 2026-05-08 | 2026-05-21 | $428.35 | $417.85 | 1.13% | 10 | |
| 2026-04-20 | 2026-04-21 | $392.50 | $386.42 | -2.22% | 2 | |
| 2025-12-04 | 2025-12-30 | $454.53 | $454.43 | 2.68% | 18 | |
| 2025-09-05 | 2025-09-15 | $350.84 | $410.04 | 16.73% | 7 | |
| 2025-08-25 | 2025-09-03 | $346.60 | $334.09 | -3.32% | 7 | |
| 2025-08-11 | 2025-08-21 | $339.03 | $320.11 | -1.94% | 9 | |
| 2025-07-21 | 2025-08-01 | $328.49 | $302.63 | -6.67% | 10 | |
| 2025-06-04 | 2025-06-05 | $332.05 | $284.70 | -3.75% | 2 | |
| 2025-06-02 | 2025-06-03 | $342.69 | $344.27 | -1.29% | 2 | |
| 2025-05-22 | 2025-05-28 | $341.04 | $356.90 | 8.23% | 4 | |
| 2025-05-12 | 2025-05-13 | $318.38 | $334.07 | 6.54% | 2 | |
| 2024-10-09 | 2024-10-10 | $241.05 | $238.77 | -1.61% | 2 | |
| 2024-10-07 | 2024-10-08 | $240.83 | $244.50 | -3.90% | 2 | |
| 2024-09-23 | 2024-10-04 | $250.00 | $250.08 | 0.81% | 10 | |
| 2024-09-16 | 2024-09-20 | $226.78 | $238.25 | 5.71% | 5 | |
| 2024-09-06 | 2024-09-09 | $210.73 | $216.27 | -8.64% | 2 | |
| 2024-01-03 | 2024-01-04 | $238.45 | $237.93 | -4.21% | 2 | |
| 2023-12-15 | 2024-01-02 | $253.50 | $248.42 | -1.22% | 11 | |
| 2023-11-16 | 2023-12-14 | $233.59 | $251.05 | -1.66% | 20 | |
| 2023-10-05 | 2023-10-17 | $260.05 | $254.85 | -2.97% | 9 | |
| 2023-08-30 | 2023-09-25 | $256.90 | $246.99 | -4.97% | 18 | |
| 2023-07-20 | 2023-07-21 | $262.90 | $260.02 | -9.93% | 2 | |
| 2023-07-18 | 2023-07-19 | $293.34 | $291.26 | 0.82% | 2 | |
| 2023-07-14 | 2023-07-17 | $281.38 | $290.38 | 1.05% | 2 | |
| 2023-07-12 | 2023-07-13 | $271.99 | $277.90 | 0.61% | 2 | |
| 2023-07-10 | 2023-07-11 | $269.61 | $269.79 | -1.95% | 2 | |
| 2023-07-05 | 2023-07-07 | $282.48 | $274.43 | -1.37% | 3 | |
| 2023-06-30 | 2023-07-03 | $261.77 | $279.82 | 1.46% | 2 | |
| 2023-06-28 | 2023-06-29 | $256.24 | $257.50 | 2.21% | 2 | |
| 2023-06-26 | 2023-06-27 | $241.05 | $250.21 | -6.25% | 2 | |
| 2022-08-15 | 2022-08-19 | $309.32 | $296.67 | 0.75% | 5 | |
| 2022-08-04 | 2022-08-12 | $308.63 | $300.03 | -6.94% | 7 | |
| 2022-03-21 | 2022-04-11 | $307.05 | $325.31 | 13.04% | 16 | |
| 2021-12-27 | 2022-01-04 | $364.65 | $383.20 | 12.22% | 7 | |
| 2021-11-23 | 2021-11-24 | $369.68 | $372.00 | -4.33% | 2 | |
| 2021-10-12 | 2021-11-10 | $268.57 | $355.98 | 28.98% | 22 | |
| 2021-10-08 | 2021-10-11 | $261.83 | $263.98 | -1.22% | 2 | |
| 2021-09-28 | 2021-10-07 | $259.19 | $264.54 | -1.29% | 8 | |
| 2021-09-24 | 2021-09-27 | $258.13 | $263.79 | 2.55% | 2 | |
| 2021-09-22 | 2021-09-23 | $250.65 | $251.21 | 1.50% | 2 | |
| 2021-08-30 | 2021-09-21 | $243.64 | $246.46 | 2.36% | 16 | |
| 2021-08-26 | 2021-08-27 | $233.72 | $237.31 | -1.61% | 2 | |
| 2021-08-24 | 2021-08-25 | $236.16 | $237.07 | 0.11% | 2 | |
| 2021-08-19 | 2021-08-20 | $224.49 | $226.75 | -2.45% | 2 | |
| 2021-07-30 | 2021-08-17 | $229.07 | $221.90 | 1.10% | 13 | |
| 2021-07-13 | 2021-07-15 | $222.85 | $216.87 | -4.91% | 3 | |
| 2021-06-24 | 2021-07-12 | $226.61 | $228.57 | -0.14% | 12 | |
| 2021-04-14 | 2021-04-29 | $244.08 | $225.67 | -9.10% | 12 | |
| 2019-12-13 | 2019-12-17 | $23.89 | $25.27 | 5.85% | 3 | |
| 2019-12-11 | 2019-12-12 | $23.51 | $23.98 | 0.91% | 2 | |
| 2019-11-26 | 2019-11-27 | $21.93 | $22.09 | -2.40% | 2 | |
| 2019-11-22 | 2019-11-25 | $22.20 | $22.42 | -6.33% | 2 | |
| 2019-03-01 | 2019-03-04 | $19.65 | $19.02 | -8.04% | 2 | |
| 2018-12-11 | 2018-12-18 | $24.45 | $22.47 | -4.77% | 6 | |
| 2018-12-07 | 2018-12-10 | $23.86 | $24.34 | -1.60% | 2 | |
| 2018-12-04 | 2018-12-06 | $23.98 | $24.20 | 0.14% | 2 | |
| 2018-11-29 | 2018-11-30 | $22.74 | $23.37 | -2.12% | 2 | |
| 2018-11-27 | 2018-11-28 | $22.93 | $23.19 | -0.80% | 2 | |
| 2018-03-13 | 2018-03-15 | $22.79 | $21.71 | -5.65% | 3 | |
| 2018-02-08 | 2018-02-09 | $21.02 | $20.69 | -8.82% | 2 | |
| 2018-01-11 | 2018-02-05 | $22.53 | $22.21 | 2.47% | 17 | |
| 2017-12-12 | 2017-12-26 | $22.74 | $21.15 | -1.32% | 10 | |
| 2017-10-13 | 2017-10-23 | $23.70 | $22.47 | -3.17% | 7 | |
| 2017-03-24 | 2017-03-28 | $17.54 | $18.50 | 5.85% | 3 | |
| 2017-03-20 | 2017-03-23 | $17.46 | $16.99 | -2.68% | 4 | |
| 2017-03-15 | 2017-03-16 | $17.05 | $17.47 | -1.08% | 2 | |
| 2017-02-01 | 2017-02-02 | $16.62 | $16.77 | -1.27% | 2 | |
| 2016-12-28 | 2017-01-25 | $14.65 | $16.96 | 15.75% | 19 | |
| 2016-07-22 | 2016-08-09 | $14.82 | $15.27 | 2.36% | 13 | |
| 2016-06-08 | 2016-06-16 | $15.70 | $14.53 | -6.49% | 7 | |
| 2015-12-29 | 2016-01-06 | $15.81 | $14.60 | -2.60% | 6 | |
| 2015-09-21 | 2015-09-30 | $17.61 | $16.56 | -5.55% | 8 | |
| 2015-08-06 | 2015-08-07 | $16.41 | $16.17 | -9.08% | 2 | |
| 2015-07-20 | 2015-07-22 | $18.82 | $17.86 | -3.06% | 3 | |
| 2015-07-15 | 2015-07-16 | $17.54 | $17.78 | -1.14% | 2 | |
| 2015-06-22 | 2015-07-09 | $17.32 | $17.19 | -3.07% | 13 | |
| 2015-06-18 | 2015-06-19 | $17.46 | $17.50 | 0.37% | 2 | |
| 2015-06-12 | 2015-06-15 | $16.71 | $16.69 | -0.49% | 2 | |
| 2015-06-09 | 2015-06-10 | $17.07 | $16.71 | -0.31% | 2 | |
| 2015-06-05 | 2015-06-08 | $16.61 | $17.09 | 1.11% | 2 | |
| 2015-06-03 | 2015-06-04 | $16.60 | $16.39 | 0.06% | 2 | |
| 2015-06-01 | 2015-06-02 | $16.63 | $16.56 | -0.74% | 2 | |
| 2015-05-28 | 2015-05-29 | $16.76 | $16.72 | 1.42% | 2 | |
| 2015-05-26 | 2015-05-27 | $16.50 | $16.50 | -0.31% | 2 | |
| 2015-05-13 | 2015-05-22 | $16.21 | $16.52 | 0.16% | 8 | |
| 2014-11-12 | 2014-12-01 | $16.61 | $15.44 | -2.81% | 13 | |
| 2014-10-07 | 2014-10-13 | $17.30 | $14.97 | -9.28% | 5 | |
| 2014-09-15 | 2014-09-16 | $16.92 | $17.38 | -9.27% | 2 | |
| 2014-09-02 | 2014-09-12 | $18.94 | $18.61 | 3.73% | 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.51% | 2 | |
| 2014-07-31 | 2014-08-25 | $14.89 | $17.50 | 11.94% | 18 | |
| 2014-07-29 | 2014-07-30 | $15.00 | $15.26 | -0.12% | 2 | |
| 2014-05-28 | 2014-07-07 | $14.02 | $14.84 | 8.14% | 28 | |
| 2014-01-07 | 2014-01-08 | $9.96 | $10.09 | 1.40% | 2 | |
| 2013-03-26 | 2013-04-02 | $2.52 | $2.96 | 16.82% | 5 | |
| 2013-03-08 | 2013-03-18 | $2.56 | $2.34 | -7.87% | 7 |