LongTermTrend_V0939
ARCHIVEDhybridllm['Relaxed and diversified entry paths: combined trend-following (close > sma_200 with slope filter), medium-term momentum (ret_20d + cumret_252d), breakout with volume, and MACD+sma50 filter to capture different robust regimes.', 'Added multi-condition exit: keep macd_hist sell but also exit on close < sma_50, stop on drawdown > 8%, or sharp 5d loss to reduce large drawdowns.', 'Introduced regime gates: allow trading only in UPTREND or SIDEWAYS, limit to LOW/MEDIUM volatility, and disallow bubbly (only NORMAL) conditions to improve generalization.', 'Reduced base_position to 0.75 to lower risk and turnover; moved volatility handling to regime gates to avoid overtrading in high-vol regimes.']
Lineage
entry = LongTermTrend_V0469 OR MACDMomentum_V0272
Strategy Logic (pseudocode)
# LongTermTrend_V0939 [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.001) or (ret_20d > 0.04 and cumret_252d > 0.03) or (breakout_50 == 1 and rel_volume > 1.2 and close > sma_50) or (macd_hist > 0.0 and close > sma_50)):
position = 0.75
if long and (macd_hist < 0.0 or close < sma_50 or drawdown > 0.08 or ret_5d < -0.05):
position = 0.0 # exit to cashBacktest Metrics
| Metric | Train | Validation | Hidden Test | Full |
|---|---|---|---|---|
| CAGR | -4.9% | 0.1% | -5.7% | -4.1% |
| Total Return | -33.3% | 0.3% | -19.6% | -46.2% |
| Sharpe | -0.21 | 0.10 | -0.21 | -0.14 |
| Sortino | -0.16 | 0.09 | -0.18 | -0.11 |
| Calmar | -0.10 | 0.00 | -0.16 | -0.08 |
| Volatility | 17.2% | 20.0% | 19.4% | 18.4% |
| Max DD | -48.8% | -23.6% | -34.6% | -54.2% |
| Win Rate | 42.1% | 42.2% | 38.0% | 40.9% |
| Avg Win | 2.2% | 3.0% | 2.8% | 2.5% |
| Avg Loss | -1.8% | -2.1% | -1.9% | -1.9% |
| Payoff | 1.20 | 1.46 | 1.47 | 1.33 |
| Expectancy | -0.1% | 0.1% | -0.1% | -0.1% |
| Profit Factor | 0.87 | 1.06 | 0.90 | 0.92 |
| Trades | 214 | 83 | 121 | 418 |
| Avg Holding Days | 3.2 | 3.2 | 3.1 | 3.2 |
| Turnover | 40.2 | 41.5 | 48.8 | 42.6 |
| Exposure | 17.4% | 18.5% | 20.5% | 18.4% |
Growth of $100
Walk-Forward Years
| Year | CAGR | Sharpe | Max DD | Trades |
|---|---|---|---|---|
| 2016 | -13.8% | -1.37 | -18.3% | 21 |
| 2017 | 8.7% | 0.76 | -11.3% | 20 |
| 2018 | -7.8% | -0.67 | -12.6% | 11 |
| 2019 | -9.3% | -0.37 | -18.4% | 12 |
| 2020 | 0.0% | 0.00 | 0.0% | 0 |
| 2021 | 1.2% | 0.19 | -23.4% | 55 |
| 2022 | -0.8% | 0.04 | -15.0% | 27 |
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 | 274 | -10.4% | -2.14 | 2% |
| hidden test | EXPENSIVE | 83 | 31.9% | 2.42 | 2% |
| hidden test | EXTREME | 48 | 0.0% | 0.00 | 0% |
| hidden test | HIGH VOLATILITY | 254 | -5.4% | -0.41 | 2% |
| hidden test | LOW VOLATILITY | 434 | 6.7% | 0.33 | 32% |
| hidden test | MEDIUM VOLATILITY | 250 | -21.1% | -0.91 | 20% |
| hidden test | NORMAL | 807 | -7.9% | -0.39 | 24% |
| hidden test | SIDEWAYS | 293 | -31.8% | -1.48 | 34% |
| hidden test | UPTREND | 371 | 22.7% | 0.95 | 24% |
| train | DOWNTREND | 518 | -15.7% | -1.32 | 1% |
| train | EXPENSIVE | 311 | 20.2% | 1.71 | 2% |
| train | EXTREME | 100 | 0.0% | 0.00 | 0% |
| train | HIGH VOLATILITY | 699 | -1.3% | -0.07 | 2% |
| train | LOW VOLATILITY | 745 | 4.5% | 0.31 | 30% |
| train | MEDIUM VOLATILITY | 568 | -17.1% | -0.92 | 21% |
| train | NORMAL | 1,601 | -8.4% | -0.45 | 22% |
| train | SIDEWAYS | 592 | -7.6% | -0.38 | 22% |
| train | UPTREND | 902 | 6.0% | 0.33 | 24% |
| validation | DOWNTREND | 125 | -4.2% | -1.73 | 1% |
| validation | EXPENSIVE | 138 | 0.0% | 0.00 | 0% |
| validation | EXTREME | 144 | 0.0% | 0.00 | 0% |
| validation | HIGH VOLATILITY | 258 | 7.9% | 0.46 | 1% |
| validation | LOW VOLATILITY | 183 | 1.1% | 0.06 | 37% |
| validation | MEDIUM VOLATILITY | 315 | -2.2% | -0.09 | 22% |
| validation | NORMAL | 474 | 3.3% | 0.13 | 29% |
| validation | SIDEWAYS | 206 | -22.4% | -1.04 | 29% |
| validation | UPTREND | 425 | 15.8% | 0.72 | 19% |
Trades (full period)
| Entry | Exit | Entry Px | Exit Px | Return | Days | |
|---|---|---|---|---|---|---|
| 2026-07-01 | 2026-07-06 | $425.30 | $419.77 | -4.97% | 3 | |
| 2026-06-05 | 2026-06-08 | $391.00 | $408.95 | -5.07% | 2 | |
| 2026-06-03 | 2026-06-04 | $423.70 | $418.45 | -0.16% | 2 | |
| 2026-05-27 | 2026-06-02 | $440.36 | $423.74 | -3.20% | 5 | |
| 2026-05-22 | 2026-05-26 | $426.01 | $433.59 | 1.31% | 2 | |
| 2026-05-20 | 2026-05-21 | $417.26 | $417.85 | 2.29% | 2 | |
| 2026-05-08 | 2026-05-19 | $428.35 | $404.11 | -0.40% | 8 | |
| 2026-04-20 | 2026-04-21 | $392.50 | $386.42 | -1.67% | 2 | |
| 2026-03-17 | 2026-03-18 | $399.27 | $392.78 | 0.55% | 2 | |
| 2026-03-12 | 2026-03-13 | $395.01 | $391.20 | -2.50% | 2 | |
| 2026-03-10 | 2026-03-11 | $399.24 | $407.82 | -0.04% | 2 | |
| 2026-03-06 | 2026-03-09 | $396.73 | $398.68 | -1.78% | 2 | |
| 2026-03-04 | 2026-03-05 | $405.94 | $405.55 | 2.43% | 2 | |
| 2026-03-02 | 2026-03-03 | $403.32 | $392.43 | 0.00% | 2 | |
| 2026-02-26 | 2026-02-27 | $408.58 | $402.51 | -1.73% | 2 | |
| 2026-02-24 | 2026-02-25 | $409.38 | $417.40 | 1.64% | 2 | |
| 2026-02-20 | 2026-02-23 | $411.82 | $399.83 | -0.13% | 2 | |
| 2026-02-18 | 2026-02-19 | $411.32 | $411.71 | -0.02% | 2 | |
| 2026-02-13 | 2026-02-17 | $417.44 | $410.63 | -0.08% | 2 | |
| 2026-02-11 | 2026-02-12 | $428.27 | $417.07 | 0.39% | 2 | |
| 2026-02-09 | 2026-02-10 | $417.32 | $425.21 | 0.98% | 2 | |
| 2026-02-05 | 2026-02-06 | $397.21 | $411.11 | -1.77% | 2 | |
| 2026-02-03 | 2026-02-04 | $421.96 | $406.01 | -0.12% | 2 | |
| 2026-01-30 | 2026-02-02 | $430.41 | $421.81 | 2.34% | 2 | |
| 2026-01-28 | 2026-01-29 | $431.46 | $416.56 | -0.05% | 2 | |
| 2026-01-26 | 2026-01-27 | $435.20 | $430.90 | -2.46% | 2 | |
| 2026-01-22 | 2026-01-23 | $449.36 | $449.06 | 2.96% | 2 | |
| 2026-01-20 | 2026-01-21 | $419.25 | $431.44 | -3.28% | 2 | |
| 2026-01-15 | 2026-01-16 | $438.57 | $437.50 | -0.26% | 2 | |
| 2026-01-13 | 2026-01-14 | $447.20 | $439.20 | -0.44% | 2 | |
| 2026-01-09 | 2026-01-12 | $445.01 | $448.96 | 1.43% | 2 | |
| 2026-01-07 | 2026-01-08 | $431.41 | $435.80 | -0.42% | 2 | |
| 2026-01-05 | 2026-01-06 | $451.67 | $432.96 | 2.18% | 2 | |
| 2025-12-31 | 2026-01-02 | $449.72 | $438.07 | -0.93% | 2 | |
| 2025-12-04 | 2025-12-30 | $454.53 | $454.43 | 2.10% | 18 | |
| 2025-12-02 | 2025-12-03 | $429.24 | $446.74 | -0.31% | 2 | |
| 2025-11-28 | 2025-12-01 | $430.17 | $430.14 | 0.48% | 2 | |
| 2025-11-25 | 2025-11-26 | $419.40 | $426.58 | 0.14% | 2 | |
| 2025-11-21 | 2025-11-24 | $391.09 | $417.78 | -0.94% | 2 | |
| 2025-11-19 | 2025-11-20 | $403.99 | $395.23 | 0.36% | 2 | |
| 2025-11-17 | 2025-11-18 | $408.92 | $401.25 | 0.70% | 2 | |
| 2025-11-13 | 2025-11-14 | $401.99 | $404.35 | -5.13% | 2 | |
| 2025-09-08 | 2025-09-15 | $346.40 | $410.04 | 9.42% | 6 | |
| 2025-09-04 | 2025-09-05 | $338.53 | $350.84 | 0.85% | 2 | |
| 2025-08-22 | 2025-09-03 | $340.01 | $334.09 | 2.06% | 8 | |
| 2025-08-11 | 2025-08-21 | $339.03 | $320.11 | -1.44% | 9 | |
| 2025-08-05 | 2025-08-06 | $308.72 | $319.91 | -0.28% | 2 | |
| 2025-07-31 | 2025-08-01 | $308.27 | $302.63 | -2.68% | 2 | |
| 2025-07-29 | 2025-07-30 | $321.20 | $319.04 | -1.16% | 2 | |
| 2025-07-21 | 2025-07-25 | $328.49 | $316.06 | -5.67% | 5 | |
| 2025-07-17 | 2025-07-18 | $319.41 | $329.65 | -0.68% | 2 | |
| 2025-07-15 | 2025-07-16 | $310.78 | $321.67 | -1.60% | 2 | |
| 2025-06-04 | 2025-06-05 | $332.05 | $284.70 | -2.81% | 2 | |
| 2025-06-02 | 2025-06-03 | $342.69 | $344.27 | -0.97% | 2 | |
| 2025-05-22 | 2025-05-28 | $341.04 | $356.90 | 6.16% | 4 | |
| 2025-05-12 | 2025-05-13 | $318.38 | $334.07 | 4.91% | 2 | |
| 2025-03-04 | 2025-03-05 | $272.04 | $279.10 | -3.47% | 2 | |
| 2025-02-28 | 2025-03-03 | $292.98 | $284.65 | 2.78% | 2 | |
| 2025-02-26 | 2025-02-27 | $290.80 | $281.95 | -3.12% | 2 | |
| 2024-10-23 | 2024-10-24 | $213.65 | $260.48 | -1.64% | 2 | |
| 2024-10-21 | 2024-10-22 | $218.85 | $217.97 | -0.78% | 2 | |
| 2024-10-17 | 2024-10-18 | $220.89 | $220.70 | -0.30% | 2 | |
| 2024-10-15 | 2024-10-16 | $219.57 | $221.33 | -0.01% | 2 | |
| 2024-10-11 | 2024-10-14 | $217.80 | $219.16 | -6.73% | 2 | |
| 2024-10-09 | 2024-10-10 | $241.05 | $238.77 | -1.21% | 2 | |
| 2024-10-07 | 2024-10-08 | $240.83 | $244.50 | -2.92% | 2 | |
| 2024-09-23 | 2024-10-04 | $250.00 | $250.08 | 0.67% | 10 | |
| 2024-09-16 | 2024-09-20 | $226.78 | $238.25 | 4.30% | 5 | |
| 2024-09-06 | 2024-09-09 | $210.73 | $216.27 | -6.48% | 2 | |
| 2024-09-04 | 2024-09-05 | $219.41 | $230.17 | 2.99% | 2 | |
| 2024-08-30 | 2024-09-03 | $214.11 | $210.60 | 2.69% | 2 | |
| 2024-06-17 | 2024-07-12 | $187.44 | $248.23 | 25.72% | 18 | |
| 2024-05-29 | 2024-05-30 | $176.19 | $178.79 | -0.39% | 2 | |
| 2024-01-11 | 2024-01-12 | $227.22 | $218.89 | -2.30% | 2 | |
| 2024-01-09 | 2024-01-10 | $234.96 | $233.94 | -1.86% | 2 | |
| 2024-01-05 | 2024-01-08 | $237.49 | $240.45 | -0.29% | 2 | |
| 2024-01-03 | 2024-01-04 | $238.45 | $237.93 | -3.16% | 2 | |
| 2023-12-15 | 2024-01-02 | $253.50 | $248.42 | -0.87% | 11 | |
| 2023-11-29 | 2023-12-14 | $244.14 | $251.05 | -2.40% | 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.32% | 2 | |
| 2023-11-20 | 2023-11-21 | $235.60 | $241.20 | 0.27% | 2 | |
| 2023-11-16 | 2023-11-17 | $233.59 | $234.30 | -3.00% | 2 | |
| 2023-11-14 | 2023-11-15 | $237.41 | $242.84 | 4.44% | 2 | |
| 2023-11-08 | 2023-11-09 | $222.11 | $209.98 | -0.17% | 2 | |
| 2023-11-06 | 2023-11-07 | $219.27 | $222.18 | -0.39% | 2 | |
| 2023-10-25 | 2023-10-26 | $212.42 | $205.76 | -1.57% | 2 | |
| 2023-10-20 | 2023-10-23 | $211.99 | $212.08 | -2.91% | 2 | |
| 2023-10-18 | 2023-10-19 | $242.68 | $220.11 | -3.73% | 2 | |
| 2023-10-05 | 2023-10-17 | $260.05 | $254.85 | -2.22% | 9 | |
| 2023-10-03 | 2023-10-04 | $246.53 | $261.16 | -1.66% | 2 | |
| 2023-09-29 | 2023-10-02 | $250.22 | $251.60 | 1.02% | 2 | |
| 2023-09-27 | 2023-09-28 | $240.50 | $246.38 | -1.26% | 2 | |
| 2023-09-25 | 2023-09-26 | $246.99 | $244.12 | 0.50% | 2 | |
| 2023-09-12 | 2023-09-22 | $267.48 | $244.88 | -5.06% | 9 | |
| 2023-09-08 | 2023-09-11 | $248.50 | $273.58 | -1.04% | 2 | |
| 2023-09-06 | 2023-09-07 | $251.92 | $251.49 | -1.49% | 2 | |
| 2023-08-29 | 2023-09-05 | $257.18 | $256.49 | 1.87% | 5 | |
| 2023-08-25 | 2023-08-28 | $238.59 | $238.82 | 2.64% | 2 | |
| 2023-08-23 | 2023-08-24 | $236.86 | $230.04 | 1.03% | 2 |