LongTermTrend_V1071
ARCHIVEDhybridllmWrapped entry logic with a volatility filter (vol_pctile < 0.85) to avoid high-volatility entries; simplified and consolidated long-term trend checks into a single branch (retain sma_200, slope, ret_20d, cumret_252d, dist_sma_50) and kept a cleaner short-term breakout branch (macd_hist + close>sma_50 or breakout_50 with high rel_volume). Replaced the fragile tiny ret_20d exit with a robust multi-condition exit: hard 20d stop (-7%), momentum fade (macd_hist<0 and ret_5d<0), and absolute drawdown (>12%). Added regime gates to restrict trading to UPTREND/SIDEWAYS, non-high volatility, and non-bubble regimes. Added position scaling rules to reduce size in HIGH_VOLATILITY, moderate in MEDIUM, and zero exposure if bubble=EXPENSIVE. Reduced full-size base_position from 1.0 to 0.8 to lower tail risk.
Lineage
entry from LongTermTrend_V0733, exit from PriceMomentum_V0690
Strategy Logic (pseudocode)
# LongTermTrend_V1071 [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 or sma_200_slope > -0.0024 or ret_20d > 0.05) and cumret_252d > -0.0248 and dist_sma_50 > -0.0774) or ((macd_hist > 0.0 and close > sma_50) or (breakout_50 == 1 and rel_volume > 2.0))) and vol_pctile < 0.85):
position = 0.8
if long and (ret_20d < -0.07 or (macd_hist < 0.0 and ret_5d < 0.0) or drawdown > 0.12):
position = 0.0 # exit to cashBacktest Metrics
| Metric | Train | Validation | Hidden Test | Full |
|---|---|---|---|---|
| CAGR | -7.4% | 7.8% | 3.2% | -1.8% |
| Total Return | -45.9% | 25.3% | 12.6% | -23.6% |
| Sharpe | -0.31 | 0.47 | 0.25 | 0.01 |
| Sortino | -0.22 | 0.39 | 0.22 | 0.01 |
| Calmar | -0.14 | 0.31 | 0.11 | -0.03 |
| Volatility | 19.0% | 20.4% | 23.3% | 20.5% |
| Max DD | -51.5% | -24.9% | -28.9% | -55.4% |
| Win Rate | 38.2% | 46.3% | 39.5% | 40.1% |
| Avg Win | 3.2% | 3.8% | 4.2% | 3.6% |
| Avg Loss | -2.5% | -2.3% | -2.3% | -2.4% |
| Payoff | 1.29 | 1.68 | 1.85 | 1.51 |
| Expectancy | -0.3% | 0.5% | 0.3% | 0.0% |
| Profit Factor | 0.79 | 1.45 | 1.20 | 1.01 |
| Trades | 152 | 54 | 76 | 282 |
| Avg Holding Days | 4.4 | 4.8 | 4.6 | 4.5 |
| Turnover | 30.5 | 28.8 | 32.6 | 30.7 |
| Exposure | 20.6% | 21.5% | 23.3% | 21.5% |
Growth of $100
Walk-Forward Years
| Year | CAGR | Sharpe | Max DD | Trades |
|---|---|---|---|---|
| 2016 | -16.0% | -1.33 | -17.4% | 16 |
| 2017 | 12.4% | 1.13 | -9.4% | 19 |
| 2018 | 4.1% | 0.40 | -7.2% | 7 |
| 2019 | -10.2% | -0.38 | -19.6% | 8 |
| 2020 | 0.0% | 0.00 | 0.0% | 0 |
| 2021 | 15.7% | 0.67 | -20.8% | 30 |
| 2022 | -2.3% | -0.02 | -24.9% | 23 |
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 | 276 | -4.5% | -1.87 | 1% |
| hidden test | EXPENSIVE | 83 | 87.0% | 2.61 | 3% |
| hidden test | EXTREME | 48 | 0.0% | 0.00 | 0% |
| hidden test | HIGH VOLATILITY | 254 | -5.4% | -0.21 | 3% |
| hidden test | LOW VOLATILITY | 436 | 8.0% | 0.39 | 33% |
| hidden test | MEDIUM VOLATILITY | 250 | 13.6% | 0.53 | 28% |
| hidden test | NORMAL | 809 | -2.1% | -0.09 | 27% |
| hidden test | SIDEWAYS | 293 | -34.9% | -1.25 | 43% |
| hidden test | UPTREND | 371 | 45.8% | 1.67 | 25% |
| train | DOWNTREND | 518 | -22.0% | -1.64 | 2% |
| train | EXPENSIVE | 311 | 21.7% | 1.71 | 2% |
| train | EXTREME | 100 | 0.0% | 0.00 | 0% |
| train | HIGH VOLATILITY | 699 | -5.0% | -0.26 | 2% |
| train | LOW VOLATILITY | 745 | 10.3% | 0.65 | 34% |
| train | MEDIUM VOLATILITY | 568 | -28.1% | -1.28 | 26% |
| train | NORMAL | 1,601 | -11.6% | -0.56 | 25% |
| train | SIDEWAYS | 592 | -14.6% | -0.68 | 26% |
| train | UPTREND | 902 | 9.1% | 0.45 | 27% |
| validation | DOWNTREND | 125 | -1.3% | -1.42 | 1% |
| validation | EXPENSIVE | 138 | 0.0% | 0.00 | 0% |
| validation | EXTREME | 144 | 0.0% | 0.00 | 0% |
| validation | HIGH VOLATILITY | 258 | -2.7% | -0.17 | 1% |
| validation | LOW VOLATILITY | 183 | 33.9% | 1.79 | 49% |
| validation | MEDIUM VOLATILITY | 315 | 5.5% | 0.23 | 22% |
| validation | NORMAL | 474 | 15.3% | 0.59 | 34% |
| validation | SIDEWAYS | 206 | 4.5% | 0.18 | 36% |
| validation | UPTREND | 425 | 15.3% | 0.72 | 21% |
Trades (full period)
| Entry | Exit | Entry Px | Exit Px | Return | Days | |
|---|---|---|---|---|---|---|
| 2026-07-20 | 2026-07-21 | $369.57 | $378.93 | -2.53% | 2 | |
| 2026-07-16 | 2026-07-17 | $391.06 | $380.84 | -0.85% | 2 | |
| 2026-07-14 | 2026-07-15 | $396.18 | $394.46 | 0.13% | 2 | |
| 2026-06-30 | 2026-07-06 | $420.60 | $419.77 | -3.69% | 4 | |
| 2026-06-26 | 2026-06-29 | $379.71 | $411.84 | 0.82% | 2 | |
| 2026-06-24 | 2026-06-25 | $375.53 | $375.12 | -1.43% | 2 | |
| 2026-06-15 | 2026-06-23 | $411.15 | $381.61 | -0.42% | 6 | |
| 2026-06-11 | 2026-06-12 | $399.15 | $406.43 | 3.52% | 2 | |
| 2026-06-09 | 2026-06-10 | $396.68 | $381.59 | -2.56% | 2 | |
| 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-22 | 2026-06-02 | $426.01 | $423.74 | -0.51% | 7 | |
| 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 | |
| 2026-03-17 | 2026-03-19 | $399.27 | $380.30 | -0.72% | 3 | |
| 2026-03-10 | 2026-03-13 | $399.24 | $391.20 | -0.88% | 4 | |
| 2026-03-05 | 2026-03-09 | $405.55 | $398.68 | -1.97% | 3 | |
| 2026-02-25 | 2026-03-04 | $417.40 | $405.94 | -3.47% | 6 | |
| 2026-02-11 | 2026-02-23 | $428.27 | $399.83 | -2.67% | 8 | |
| 2026-02-09 | 2026-02-10 | $417.32 | $425.21 | 1.05% | 2 | |
| 2026-02-04 | 2026-02-05 | $406.01 | $397.21 | -3.18% | 2 | |
| 2026-02-02 | 2026-02-03 | $421.81 | $421.96 | -1.76% | 2 | |
| 2026-01-29 | 2026-01-30 | $416.56 | $430.41 | -2.92% | 2 | |
| 2026-01-27 | 2026-01-28 | $430.90 | $431.46 | -0.95% | 2 | |
| 2026-01-23 | 2026-01-26 | $449.06 | $435.20 | -0.21% | 2 | |
| 2026-01-21 | 2026-01-22 | $431.44 | $449.36 | 2.16% | 2 | |
| 2026-01-16 | 2026-01-20 | $437.50 | $419.25 | -0.35% | 2 | |
| 2026-01-14 | 2026-01-15 | $439.20 | $438.57 | -1.59% | 2 | |
| 2026-01-09 | 2026-01-13 | $445.01 | $447.20 | 2.25% | 3 | |
| 2026-01-07 | 2026-01-08 | $431.41 | $435.80 | -0.45% | 2 | |
| 2026-01-05 | 2026-01-06 | $451.67 | $432.96 | 2.32% | 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-11-28 | 2025-12-03 | $430.17 | $446.74 | 0.34% | 4 | |
| 2025-11-25 | 2025-11-26 | $419.40 | $426.58 | 0.15% | 2 | |
| 2025-11-19 | 2025-11-20 | $403.99 | $395.23 | 0.39% | 2 | |
| 2025-11-17 | 2025-11-18 | $408.92 | $401.25 | 0.74% | 2 | |
| 2025-11-13 | 2025-11-14 | $401.99 | $404.35 | -5.47% | 2 | |
| 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-22 | 2025-09-03 | $340.01 | $334.09 | 2.19% | 8 | |
| 2025-08-11 | 2025-08-21 | $339.03 | $320.11 | -1.54% | 9 | |
| 2025-08-05 | 2025-08-06 | $308.72 | $319.91 | -0.30% | 2 | |
| 2025-07-14 | 2025-08-04 | $316.90 | $309.26 | -2.83% | 16 | |
| 2025-07-10 | 2025-07-11 | $309.87 | $313.51 | 3.62% | 2 | |
| 2025-07-08 | 2025-07-09 | $297.81 | $295.88 | 0.89% | 2 | |
| 2025-06-05 | 2025-06-06 | $284.70 | $295.14 | -11.56% | 2 | |
| 2025-06-02 | 2025-06-04 | $342.69 | $332.05 | -0.66% | 3 | |
| 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-24 | 2024-10-25 | $260.48 | $269.19 | 17.36% | 2 | |
| 2024-10-22 | 2024-10-23 | $217.97 | $213.65 | -0.48% | 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-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-17 | 2024-01-18 | $215.55 | $211.88 | -1.74% | 2 | |
| 2024-01-11 | 2024-01-12 | $227.22 | $218.89 | -2.46% | 2 | |
| 2024-01-09 | 2024-01-10 | $234.96 | $233.94 | -1.99% | 2 | |
| 2024-01-05 | 2024-01-08 | $237.49 | $240.45 | -0.31% | 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-14 | 2023-12-14 | $237.41 | $251.05 | 5.46% | 22 | |
| 2023-10-19 | 2023-10-20 | $220.11 | $211.99 | -7.59% | 2 | |
| 2023-10-17 | 2023-10-18 | $254.85 | $242.68 | 0.13% | 2 | |
| 2023-10-05 | 2023-10-16 | $260.05 | $253.92 | -3.23% | 8 | |
| 2023-08-30 | 2023-09-25 | $256.90 | $246.99 | -3.85% | 18 | |
| 2023-07-27 | 2023-07-28 | $255.71 | $266.44 | -2.77% | 2 | |
| 2023-07-24 | 2023-07-25 | $269.06 | $265.28 | 2.62% | 2 | |
| 2023-07-13 | 2023-07-21 | $277.90 | $260.02 | -2.74% | 7 | |
| 2023-06-30 | 2023-07-12 | $261.77 | $271.99 | 3.68% | 8 | |
| 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-29 | 2023-04-06 | $193.88 | $185.06 | -1.63% | 7 | |
| 2023-03-24 | 2023-03-28 | $190.41 | $189.19 | -0.33% | 3 | |
| 2022-09-30 | 2022-10-03 | $265.25 | $242.40 | -1.04% | 2 | |
| 2022-09-28 | 2022-09-29 | $287.81 | $268.21 | 1.22% | 2 | |
| 2022-09-26 | 2022-09-27 | $276.01 | $282.94 | 0.04% | 2 | |
| 2022-09-07 | 2022-09-23 | $283.70 | $275.33 | 4.02% | 13 | |
| 2022-09-02 | 2022-09-06 | $270.21 | $274.42 | -2.16% | 2 | |
| 2022-08-31 | 2022-09-01 | $275.61 | $277.16 | -0.76% | 2 | |
| 2022-08-29 | 2022-08-30 | $284.82 | $277.70 | -1.07% | 2 | |
| 2022-08-25 | 2022-08-26 | $296.07 | $288.09 | -0.44% | 2 | |
| 2022-08-23 | 2022-08-24 | $296.45 | $297.10 | 1.64% | 2 | |
| 2022-08-15 | 2022-08-22 | $309.32 | $289.91 | -1.04% | 6 | |
| 2022-08-02 | 2022-08-12 | $300.59 | $300.03 | -2.97% | 9 | |
| 2022-05-05 | 2022-05-06 | $291.09 | $288.55 | -6.82% | 2 | |
| 2022-05-03 | 2022-05-04 | $303.08 | $317.54 | 0.40% | 2 | |
| 2022-04-29 | 2022-05-02 | $290.25 | $300.98 | -0.77% | 2 | |
| 2022-04-27 | 2022-04-28 | $293.84 | $292.50 | 0.30% | 2 | |
| 2022-04-22 | 2022-04-26 | $335.02 | $292.14 | -1.01% | 3 | |
| 2022-04-19 | 2022-04-21 | $342.72 | $336.26 | -2.29% | 3 | |
| 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-18 | 2022-04-11 | $301.80 | $325.31 | 13.91% | 17 | |
| 2022-02-16 | 2022-02-17 | $307.80 | $292.12 | -0.08% | 2 | |
| 2022-02-10 | 2022-02-11 | $301.52 | $286.67 | -2.51% | 2 | |
| 2022-01-12 | 2022-01-13 | $368.74 | $343.85 | 2.98% | 2 | |
| 2021-12-23 | 2022-01-04 | $355.67 | $383.20 | 14.87% | 8 |