LongTermTrend_V0575
ARCHIVEDhybridllm1) Added a strict regime gate: only allow entries in UPTREND to reduce drawdowns in bad market regimes. 2) Simplified and refocused entry logic into three clear branches: trend-follow (close>sma_200 + positive sma_200_slope + modest 20d return), volume-backed 50-day breakout, and MACD-confirmed pullup over sma_50. 3) Tightened sma_200_slope threshold to prefer stronger structural uptrends. 4) Improved exit logic: exit on negative MACD histogram OR large drawdown (>15%) OR sma_50 crossing below sma_200 for faster risk control. 5) Introduced multi-level volatility scaling (LOW=1.0, MEDIUM=0.6, HIGH=0.3) and reduced base_position to 0.7 to limit position size and turnover during turbulent periods.
Lineage
logic of LongTermTrend_V0452 with risk overlay of Breakout20_V0374
Strategy Logic (pseudocode)
# LongTermTrend_V0575 [hybrid]
if flat and ((close > sma_200 and sma_200_slope > -0.001 and ret_20d > 0.03 and cumret_252d > -0.2) or (breakout_50 == 1 and rel_volume > 1.3 and close > sma_50) or (macd_hist > 0.0 and close > sma_50)):
position = 0.7
if long and (macd_hist < 0.0 or drawdown < -0.15 or sma_50 < sma_200):
position = 0.0 # exit to cash
if regime.volatility == "HIGH_VOLATILITY": position *= 0.3
if regime.volatility == "MEDIUM_VOLATILITY": position *= 0.6
if regime.volatility == "LOW_VOLATILITY": position *= 1.0Backtest Metrics
| Metric | Train | Validation | Hidden Test | Full |
|---|---|---|---|---|
| CAGR | 2.4% | 27.4% | -1.0% | 6.3% |
| Total Return | 21.2% | 106.7% | -3.7% | 146.2% |
| Sharpe | 0.25 | 1.46 | -0.01 | 0.49 |
| Sortino | 0.24 | 1.93 | -0.01 | 0.52 |
| Calmar | 0.07 | 1.59 | -0.05 | 0.18 |
| Volatility | 13.5% | 17.7% | 13.7% | 14.5% |
| Max DD | -36.0% | -17.3% | -22.5% | -36.0% |
| Win Rate | 46.0% | 52.6% | 47.4% | 47.8% |
| Avg Win | 1.4% | 2.2% | 1.3% | 1.6% |
| Avg Loss | -1.1% | -1.2% | -1.1% | -1.1% |
| Payoff | 1.29 | 1.90 | 1.10 | 1.43 |
| Expectancy | 0.1% | 0.6% | -0.0% | 0.2% |
| Profit Factor | 1.10 | 2.11 | 0.99 | 1.31 |
| Trades | 326 | 133 | 194 | 653 |
| Avg Holding Days | 3.0 | 3.2 | 2.2 | 2.9 |
| Turnover | 41.3 | 39.9 | 50.0 | 43.1 |
| Exposure | 15.7% | 16.7% | 12.5% | 15.1% |
Growth of $100
Walk-Forward Years
| Year | CAGR | Sharpe | Max DD | Trades |
|---|---|---|---|---|
| 2016 | 3.1% | 0.48 | -5.9% | 38 |
| 2017 | -2.7% | -0.17 | -10.6% | 41 |
| 2018 | -8.2% | -0.83 | -12.0% | 49 |
| 2019 | 10.0% | 0.86 | -8.2% | 32 |
| 2020 | 86.4% | 2.96 | -8.4% | 47 |
| 2021 | 5.9% | 0.41 | -15.1% | 57 |
| 2022 | -1.1% | -0.05 | -9.8% | 28 |
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 | 0.7% | 0.10 | 5% |
| hidden test | EXPENSIVE | 83 | 31.4% | 1.48 | 22% |
| hidden test | EXTREME | 48 | 26.9% | 1.33 | 14% |
| hidden test | HIGH VOLATILITY | 254 | 3.4% | 0.38 | 6% |
| hidden test | LOW VOLATILITY | 429 | 12.6% | 0.90 | 17% |
| hidden test | MEDIUM VOLATILITY | 250 | -25.4% | -1.53 | 11% |
| hidden test | NORMAL | 802 | -5.0% | -0.41 | 11% |
| hidden test | SIDEWAYS | 293 | -12.6% | -1.08 | 14% |
| hidden test | UPTREND | 371 | 9.2% | 0.51 | 17% |
| train | DOWNTREND | 518 | -6.3% | -0.77 | 4% |
| train | EXPENSIVE | 311 | 18.1% | 1.07 | 25% |
| train | EXTREME | 100 | 85.1% | 4.39 | 26% |
| train | HIGH VOLATILITY | 699 | 7.5% | 0.59 | 8% |
| train | LOW VOLATILITY | 745 | 5.4% | 0.37 | 26% |
| train | MEDIUM VOLATILITY | 568 | -4.6% | -0.35 | 13% |
| train | NORMAL | 1,601 | -4.7% | -0.38 | 13% |
| train | SIDEWAYS | 592 | 1.4% | 0.13 | 12% |
| train | UPTREND | 902 | 10.1% | 0.59 | 25% |
| validation | DOWNTREND | 125 | 17.9% | 1.54 | 2% |
| validation | EXPENSIVE | 138 | 27.9% | 1.33 | 22% |
| validation | EXTREME | 144 | 91.7% | 3.99 | 21% |
| validation | HIGH VOLATILITY | 258 | 15.3% | 0.94 | 8% |
| validation | LOW VOLATILITY | 183 | 12.3% | 0.78 | 27% |
| validation | MEDIUM VOLATILITY | 315 | 42.1% | 2.14 | 18% |
| validation | NORMAL | 474 | 5.1% | 0.35 | 14% |
| validation | SIDEWAYS | 206 | -9.7% | -1.20 | 10% |
| validation | UPTREND | 425 | 45.2% | 2.06 | 24% |
Trades (full period)
| Entry | Exit | Entry Px | Exit Px | Return | Days | |
|---|---|---|---|---|---|---|
| 2026-09-22 | — | — | — | -0.04% | 1 | OPEN |
| 2026-09-18 | 2026-09-21 | $364.27 | $375.30 | -0.31% | 2 | |
| 2026-09-15 | 2026-09-16 | $356.58 | $358.08 | -0.36% | 2 | |
| 2026-09-11 | 2026-09-14 | $365.44 | $358.97 | 0.13% | 2 | |
| 2026-09-09 | 2026-09-10 | $367.81 | $363.56 | -0.12% | 2 | |
| 2026-09-04 | 2026-09-08 | $354.08 | $368.16 | -4.28% | 2 | |
| 2026-09-01 | 2026-09-02 | $356.09 | $357.01 | -2.39% | 2 | |
| 2026-07-07 | 2026-07-08 | $402.90 | $394.06 | -0.89% | 2 | |
| 2026-07-01 | 2026-07-02 | $425.30 | $393.45 | 0.39% | 2 | |
| 2026-06-04 | 2026-06-05 | $418.45 | $391.00 | -1.01% | 2 | |
| 2026-06-02 | 2026-06-03 | $423.74 | $423.70 | 1.18% | 2 | |
| 2026-05-29 | 2026-06-01 | $435.79 | $415.88 | -1.14% | 2 | |
| 2026-05-27 | 2026-05-28 | $440.36 | $442.10 | 0.95% | 2 | |
| 2026-05-22 | 2026-05-26 | $426.01 | $433.59 | 1.23% | 2 | |
| 2026-05-20 | 2026-05-21 | $417.26 | $417.85 | 2.14% | 2 | |
| 2026-05-18 | 2026-05-19 | $409.99 | $404.11 | -2.17% | 2 | |
| 2026-05-14 | 2026-05-15 | $443.30 | $422.24 | -0.45% | 2 | |
| 2026-05-12 | 2026-05-13 | $433.45 | $445.27 | -1.96% | 2 | |
| 2026-05-08 | 2026-05-11 | $428.35 | $445.00 | 2.67% | 2 | |
| 2026-05-06 | 2026-05-07 | $398.73 | $411.79 | 1.54% | 2 | |
| 2026-05-04 | 2026-05-05 | $392.51 | $389.37 | 0.16% | 2 | |
| 2026-04-20 | 2026-04-21 | $392.50 | $386.42 | -0.93% | 2 | |
| 2026-04-16 | 2026-04-17 | $388.90 | $400.62 | -0.41% | 2 | |
| 2025-12-31 | 2026-01-02 | $449.72 | $438.07 | -0.86% | 2 | |
| 2025-12-04 | 2025-12-30 | $454.53 | $454.43 | 1.49% | 18 | |
| 2025-11-10 | 2025-11-11 | $445.23 | $439.62 | 1.45% | 2 | |
| 2025-11-06 | 2025-11-07 | $445.91 | $429.52 | -1.55% | 2 | |
| 2025-11-03 | 2025-11-05 | $468.37 | $462.07 | -2.69% | 3 | |
| 2025-10-29 | 2025-10-30 | $461.51 | $440.10 | 0.00% | 2 | |
| 2025-10-24 | 2025-10-27 | $433.72 | $452.42 | -1.51% | 2 | |
| 2025-10-22 | 2025-10-23 | $438.97 | $448.98 | -0.43% | 2 | |
| 2025-10-20 | 2025-10-21 | $447.43 | $442.60 | 0.69% | 2 | |
| 2025-10-13 | 2025-10-14 | $435.90 | $429.24 | 2.19% | 2 | |
| 2025-10-09 | 2025-10-10 | $435.54 | $413.49 | -0.39% | 2 | |
| 2025-10-07 | 2025-10-08 | $433.09 | $438.69 | -1.95% | 2 | |
| 2025-09-16 | 2025-10-06 | $421.62 | $453.25 | 2.38% | 15 | |
| 2025-09-12 | 2025-09-15 | $395.94 | $410.04 | 5.01% | 2 | |
| 2025-09-10 | 2025-09-11 | $347.79 | $368.81 | 0.03% | 2 | |
| 2025-09-08 | 2025-09-09 | $346.40 | $346.97 | -1.03% | 2 | |
| 2025-09-04 | 2025-09-05 | $338.53 | $350.84 | 0.79% | 2 | |
| 2025-08-29 | 2025-09-02 | $333.87 | $329.36 | -2.59% | 2 | |
| 2025-08-27 | 2025-08-28 | $349.60 | $345.98 | -0.55% | 2 | |
| 2025-08-25 | 2025-08-26 | $346.60 | $351.67 | 1.22% | 2 | |
| 2025-08-20 | 2025-08-21 | $323.90 | $320.11 | -1.29% | 2 | |
| 2025-08-18 | 2025-08-19 | $335.16 | $329.31 | 0.83% | 2 | |
| 2025-08-14 | 2025-08-15 | $335.58 | $330.56 | -0.92% | 2 | |
| 2025-08-12 | 2025-08-13 | $340.84 | $339.38 | 0.23% | 2 | |
| 2025-08-08 | 2025-08-11 | $329.65 | $339.03 | 1.46% | 2 | |
| 2025-07-29 | 2025-07-30 | $321.20 | $319.04 | -0.65% | 2 | |
| 2025-07-23 | 2025-07-24 | $332.56 | $305.30 | -0.05% | 2 | |
| 2025-07-21 | 2025-07-22 | $328.49 | $332.11 | -0.23% | 2 | |
| 2025-06-25 | 2025-06-26 | $327.55 | $325.78 | -0.84% | 2 | |
| 2025-06-10 | 2025-06-11 | $326.09 | $326.43 | 1.15% | 2 | |
| 2025-06-04 | 2025-06-05 | $332.05 | $284.70 | -1.57% | 2 | |
| 2025-06-02 | 2025-06-03 | $342.69 | $344.27 | -0.54% | 2 | |
| 2025-05-29 | 2025-05-30 | $358.43 | $346.46 | 0.10% | 2 | |
| 2025-05-27 | 2025-05-28 | $362.89 | $356.90 | 4.71% | 2 | |
| 2025-05-22 | 2025-05-23 | $341.04 | $339.34 | 0.72% | 2 | |
| 2025-05-20 | 2025-05-21 | $343.82 | $334.62 | 0.13% | 2 | |
| 2025-05-16 | 2025-05-19 | $349.98 | $342.09 | 0.40% | 2 | |
| 2025-05-14 | 2025-05-15 | $347.68 | $342.82 | 0.81% | 2 | |
| 2025-05-12 | 2025-05-13 | $318.38 | $334.07 | 2.75% | 2 | |
| 2025-05-08 | 2025-05-09 | $284.82 | $298.26 | 0.61% | 2 | |
| 2025-05-06 | 2025-05-07 | $275.35 | $276.22 | -0.41% | 2 | |
| 2025-05-02 | 2025-05-05 | $287.21 | $280.26 | 0.46% | 2 | |
| 2025-04-30 | 2025-05-01 | $282.16 | $280.52 | -0.75% | 2 | |
| 2025-04-28 | 2025-04-29 | $285.88 | $292.03 | 0.03% | 2 | |
| 2025-01-06 | 2025-01-07 | $411.05 | $394.36 | -0.01% | 2 | |
| 2025-01-02 | 2025-01-03 | $379.28 | $410.44 | -1.32% | 2 | |
| 2024-12-30 | 2024-12-31 | $417.41 | $403.84 | -0.74% | 2 | |
| 2024-12-26 | 2024-12-27 | $454.13 | $431.66 | -0.41% | 2 | |
| 2024-12-06 | 2024-12-24 | $389.22 | $462.28 | 4.70% | 13 | |
| 2024-12-04 | 2024-12-05 | $357.93 | $369.49 | 0.35% | 2 | |
| 2024-12-02 | 2024-12-03 | $357.09 | $351.42 | 0.68% | 2 | |
| 2024-11-27 | 2024-11-29 | $332.89 | $345.16 | -0.37% | 2 | |
| 2024-11-22 | 2024-11-26 | $352.56 | $338.23 | -0.08% | 3 | |
| 2024-11-20 | 2024-11-21 | $342.03 | $339.64 | -0.28% | 2 | |
| 2024-11-18 | 2024-11-19 | $338.74 | $346.00 | 1.14% | 2 | |
| 2024-11-14 | 2024-11-15 | $311.18 | $320.72 | -1.25% | 2 | |
| 2024-11-12 | 2024-11-13 | $328.49 | $330.24 | -1.33% | 2 | |
| 2024-11-08 | 2024-11-11 | $321.22 | $350.00 | 1.68% | 2 | |
| 2024-11-06 | 2024-11-07 | $288.53 | $296.91 | 3.06% | 2 | |
| 2024-11-04 | 2024-11-05 | $242.84 | $251.44 | -0.56% | 2 | |
| 2024-10-31 | 2024-11-01 | $249.85 | $248.98 | -0.67% | 2 | |
| 2024-10-29 | 2024-10-30 | $259.52 | $257.55 | -0.28% | 2 | |
| 2024-10-25 | 2024-10-28 | $269.19 | $262.51 | 0.66% | 2 | |
| 2024-10-11 | 2024-10-14 | $217.80 | $219.16 | -6.28% | 2 | |
| 2024-10-09 | 2024-10-10 | $241.05 | $238.77 | -1.13% | 2 | |
| 2024-10-07 | 2024-10-08 | $240.83 | $244.50 | -2.73% | 2 | |
| 2024-10-03 | 2024-10-04 | $240.66 | $250.08 | -1.49% | 2 | |
| 2024-10-01 | 2024-10-02 | $258.02 | $249.02 | -0.66% | 2 | |
| 2024-09-27 | 2024-09-30 | $260.46 | $261.63 | 0.95% | 2 | |
| 2024-09-25 | 2024-09-26 | $257.02 | $254.22 | 0.37% | 2 | |
| 2024-09-23 | 2024-09-24 | $250.00 | $254.27 | 1.99% | 2 | |
| 2024-09-19 | 2024-09-20 | $243.92 | $238.25 | 3.01% | 2 | |
| 2024-09-17 | 2024-09-18 | $227.87 | $227.20 | 0.12% | 2 | |
| 2024-09-13 | 2024-09-16 | $230.29 | $226.78 | 0.00% | 2 | |
| 2024-09-11 | 2024-09-12 | $228.13 | $229.81 | 0.14% | 2 | |
| 2024-09-09 | 2024-09-10 | $216.27 | $226.17 | 0.51% | 2 | |
| 2024-09-05 | 2024-09-06 | $230.17 | $210.73 | 1.97% | 2 |