LongTermTrend_V0965
ARCHIVEDhybridllmAdded volatility gate and bubble filter to avoid trading in high-risk regimes; tightened entry to require either long-term trend strength (close>sma200 + slope + 20d return) or strong short-term breakout (breakout_50 + rel_volume + close>sma50) or positive MACD histogram with price above sma50; require vol_pctile<0.85 to avoid entries into very high volatility; improved exit to be multi-condition (macd_hist<0 OR price crossing below sma50 OR drawdown>12%) to cut losses earlier; reduced base position to 0.8 and added position rules to scale up to full size on high-quality breakouts and scale down in elevated volatility.
Lineage
entry = LongTermTrend_V0469 OR MACDMomentum_V0272
Strategy Logic (pseudocode)
# LongTermTrend_V0965 [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.0024 and ret_20d > 0.05) or (breakout_50 == 1 and rel_volume > 1.5 and close > sma_50) or (macd_hist > 0.0 and close > sma_50)) and vol_pctile < 0.85):
position = 0.8
if long and (macd_hist < 0.0 or drawdown > 0.12 or close < sma_50):
position = 0.0 # exit to cashBacktest Metrics
| Metric | Train | Validation | Hidden Test | Full |
|---|---|---|---|---|
| CAGR | -2.9% | 0.1% | 0.8% | -1.4% |
| Total Return | -21.1% | 0.4% | 2.9% | -18.5% |
| Sharpe | -0.13 | 0.09 | 0.13 | -0.01 |
| Sortino | -0.08 | 0.06 | 0.09 | -0.01 |
| Calmar | -0.07 | 0.01 | 0.02 | -0.03 |
| Volatility | 14.7% | 15.7% | 17.2% | 15.6% |
| Max DD | -40.9% | -21.1% | -32.3% | -43.2% |
| Win Rate | 37.6% | 41.4% | 41.7% | 39.5% |
| Avg Win | 3.5% | 3.7% | 4.2% | 3.8% |
| Avg Loss | -2.4% | -2.4% | -2.7% | -2.5% |
| Payoff | 1.44 | 1.56 | 1.58 | 1.51 |
| Expectancy | -0.2% | 0.1% | 0.2% | -0.0% |
| Profit Factor | 0.87 | 1.10 | 1.13 | 0.99 |
| Trades | 85 | 29 | 48 | 162 |
| Avg Holding Days | 4.9 | 5.6 | 4.8 | 5.0 |
| Turnover | 17.0 | 15.5 | 20.6 | 17.6 |
| Exposure | 13.3% | 14.1% | 15.7% | 14.0% |
Growth of $100
Walk-Forward Years
| Year | CAGR | Sharpe | Max DD | Trades |
|---|---|---|---|---|
| 2016 | -5.5% | -0.49 | -10.7% | 11 |
| 2017 | 10.5% | 1.17 | -4.4% | 7 |
| 2018 | -7.4% | -0.91 | -11.4% | 5 |
| 2019 | -8.6% | -0.30 | -19.6% | 8 |
| 2020 | 0.0% | 0.00 | 0.0% | 0 |
| 2021 | -2.5% | -0.00 | -21.0% | 20 |
| 2022 | 3.1% | 0.27 | -17.1% | 8 |
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 | 275 | -2.8% | -1.38 | 1% |
| hidden test | EXPENSIVE | 83 | 34.2% | 2.44 | 2% |
| hidden test | EXTREME | 48 | 0.0% | 0.00 | 0% |
| hidden test | HIGH VOLATILITY | 254 | -8.7% | -0.63 | 2% |
| hidden test | LOW VOLATILITY | 434 | 15.4% | 0.87 | 24% |
| hidden test | MEDIUM VOLATILITY | 251 | -9.3% | -0.48 | 15% |
| hidden test | NORMAL | 808 | -0.9% | -0.05 | 18% |
| hidden test | SIDEWAYS | 293 | -21.9% | -1.15 | 28% |
| hidden test | UPTREND | 371 | 25.1% | 1.18 | 17% |
| train | DOWNTREND | 518 | -6.5% | -1.21 | 1% |
| train | EXPENSIVE | 311 | 10.3% | 1.83 | 2% |
| train | EXTREME | 100 | 0.0% | 0.00 | 0% |
| train | HIGH VOLATILITY | 699 | 1.9% | 0.13 | 1% |
| train | LOW VOLATILITY | 745 | 8.1% | 0.56 | 25% |
| train | MEDIUM VOLATILITY | 568 | -19.7% | -1.28 | 13% |
| train | NORMAL | 1,601 | -4.4% | -0.27 | 16% |
| train | SIDEWAYS | 592 | -8.2% | -0.51 | 18% |
| train | UPTREND | 902 | 4.9% | 0.28 | 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 | -6.6% | -0.66 | 1% |
| validation | LOW VOLATILITY | 183 | 4.6% | 0.31 | 32% |
| validation | MEDIUM VOLATILITY | 315 | 6.0% | 0.31 | 14% |
| validation | NORMAL | 474 | 2.2% | 0.11 | 22% |
| validation | SIDEWAYS | 206 | -8.0% | -0.45 | 20% |
| validation | UPTREND | 425 | 6.3% | 0.37 | 15% |
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-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-08 | 2026-05-21 | $428.35 | $417.85 | 0.97% | 10 | |
| 2026-04-20 | 2026-04-21 | $392.50 | $386.42 | -1.78% | 2 | |
| 2025-12-31 | 2026-01-02 | $449.72 | $438.07 | -0.99% | 2 | |
| 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-08-11 | 2025-08-21 | $339.03 | $320.11 | -1.54% | 9 | |
| 2025-07-29 | 2025-07-30 | $321.20 | $319.04 | -1.24% | 2 | |
| 2025-07-21 | 2025-07-25 | $328.49 | $316.06 | -6.05% | 5 | |
| 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 | |
| 2025-05-12 | 2025-05-13 | $318.38 | $334.07 | 5.23% | 2 | |
| 2024-10-09 | 2024-10-10 | $241.05 | $238.77 | -1.29% | 2 | |
| 2024-10-07 | 2024-10-08 | $240.83 | $244.50 | -3.12% | 2 | |
| 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-09-04 | 2024-09-05 | $219.41 | $230.17 | 3.18% | 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 | |
| 2023-12-15 | 2024-01-02 | $253.50 | $248.42 | -0.94% | 11 | |
| 2023-11-29 | 2023-12-14 | $244.14 | $251.05 | -2.56% | 12 | |
| 2023-11-27 | 2023-11-28 | $236.08 | $246.72 | 0.05% | 2 | |
| 2023-11-22 | 2023-11-24 | $234.21 | $235.45 | -2.48% | 2 | |
| 2023-11-20 | 2023-11-21 | $235.60 | $241.20 | 0.28% | 2 | |
| 2023-11-16 | 2023-11-17 | $233.59 | $234.30 | -3.20% | 2 | |
| 2023-10-06 | 2023-10-17 | $260.53 | $254.85 | -2.03% | 8 | |
| 2023-09-25 | 2023-09-26 | $246.99 | $244.12 | 0.53% | 2 | |
| 2023-09-12 | 2023-09-22 | $267.48 | $244.88 | -5.39% | 9 | |
| 2023-09-06 | 2023-09-07 | $251.92 | $251.49 | -1.58% | 2 | |
| 2023-08-30 | 2023-09-05 | $256.90 | $256.49 | -3.94% | 4 | |
| 2023-07-26 | 2023-07-27 | $264.35 | $255.71 | -0.44% | 2 | |
| 2023-07-20 | 2023-07-21 | $262.90 | $260.02 | -7.94% | 2 | |
| 2023-07-18 | 2023-07-19 | $293.34 | $291.26 | 0.65% | 2 | |
| 2023-07-14 | 2023-07-17 | $281.38 | $290.38 | 0.84% | 2 | |
| 2023-07-12 | 2023-07-13 | $271.99 | $277.90 | 0.49% | 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-06-30 | 2023-07-03 | $261.77 | $279.82 | 1.17% | 2 | |
| 2023-06-28 | 2023-06-29 | $256.24 | $257.50 | 1.77% | 2 | |
| 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-16 | 2022-08-19 | $306.56 | $296.67 | -1.83% | 4 | |
| 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-03 | $362.82 | $399.93 | -2.88% | 5 | |
| 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-27 | 2021-10-07 | $263.79 | $264.54 | 0.71% | 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.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-07-21 | 2021-07-22 | $218.43 | $216.42 | -0.79% | 2 | |
| 2021-07-16 | 2021-07-19 | $214.74 | $215.41 | -0.94% | 2 | |
| 2021-07-13 | 2021-07-15 | $222.85 | $216.87 | -3.94% | 3 | |
| 2021-06-24 | 2021-07-12 | $226.61 | $228.57 | -0.08% | 12 | |
| 2021-06-22 | 2021-06-23 | $207.90 | $218.86 | 0.21% | 2 | |
| 2021-06-18 | 2021-06-21 | $207.77 | $206.94 | 0.71% | 2 | |
| 2021-06-14 | 2021-06-15 | $205.90 | $199.79 | 0.86% | 2 | |
| 2021-05-03 | 2021-05-04 | $228.30 | $224.53 | -2.92% | 2 | |
| 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-12-03 | 2019-12-04 | $22.41 | $22.20 | 0.16% | 2 | |
| 2019-11-29 | 2019-12-02 | $22.00 | $22.32 | -0.49% | 2 | |
| 2019-11-22 | 2019-11-25 | $22.20 | $22.42 | -5.07% | 2 | |
| 2019-10-15 | 2019-10-25 | $17.19 | $21.88 | 13.15% | 9 | |
| 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 | |
| 2019-03-01 | 2019-03-04 | $19.65 | $19.02 | -6.43% | 2 | |
| 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-11-29 | 2018-11-30 | $22.74 | $23.37 | -1.70% | 2 | |
| 2018-03-13 | 2018-03-15 | $22.79 | $21.71 | -4.53% | 3 | |
| 2018-01-11 | 2018-02-05 | $22.53 | $22.21 | 2.00% | 17 | |
| 2017-12-12 | 2017-12-26 | $22.74 | $21.15 | -1.04% | 10 | |
| 2017-10-18 | 2017-10-20 | $23.98 | $23.01 | -1.04% | 3 | |
| 2017-10-12 | 2017-10-17 | $23.71 | $23.72 | -1.06% | 4 | |
| 2017-03-24 | 2017-03-28 | $17.54 | $18.50 | 4.67% | 3 | |
| 2017-03-20 | 2017-03-22 | $17.46 | $17.00 | -3.46% | 3 | |
| 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-10 | $15.70 | $14.59 | -1.18% | 3 | |
| 2016-04-29 | 2016-05-02 | $16.05 | $16.12 | -2.40% | 2 |