BtcDailyHeadAndShouldersReversalLongShort
Hypotheses
BTC Single-Asset Head-and-Shoulders 5-Element Reversal Long-Short on BINANCE Daily (Edwards-Magee 1948 / Bulkowski 2005 Classical Pattern, 83pct Follow-Through, Event-Driven)
Hypotheses
Single-asset Head-and-Shoulders / Inverse Head-and-Shoulders 5-element pattern strategy on BTCUSDT.BINANCE — detects the most iconic chart pattern in classical technical analysis: 3 peaks with the CENTER peak (head) HIGHEST, flanked by 2 LOWER peaks (shoulders) at similar heights, connected by a NECKLINE through the intervening troughs. Mechanism: (1) Scan last 50 bars for 3 peaks where the middle peak is the highest. (2) BEARISH HEAD-AND-SHOULDERS: peaks[0] is left shoulder, peaks[1] is head (highest), peaks[2] is right shoulder; shoulder_diff = abs(peaks[0].high - peaks[2].high) / peaks[0].high <= shoulder_tolerance (default 3%, shoulders at similar height); peaks[1].high > peaks[0].high × (1 + head_prominence) AND peaks[1].high > peaks[2].high × (1 + head_prominence) (default 2%, head clearly higher); neckline computed as line between trough_left (between left shoulder and head) and trough_right (between head and right shoulder); current bar's close < neckline_value × (1 - neckline_break_buffer) (default 0.5%, decisive break below the neckline). (3) BULLISH INVERSE H&S: mirror logic with 3 troughs, middle deepest. (4) FLAT otherwise. This implements Edwards-Magee's 1948 'Technical Analysis of Stock Trends' Head-and-Shoulders pattern — the SINGLE MOST RELIABLE chart pattern per Bulkowski 2005 'Encyclopedia of Chart Patterns' statistical study (83% follow-through). Distinct from my 18 in-pipeline event-driven BTC patterns. Double-Top (in pipeline) uses 2 peaks at equal height; Triple-Top (in pipeline) uses 3 peaks at equal height; H&S uses 3 peaks with SPECIFIC HEAD-HIGHEST topology — fundamentally different structural signature requiring head prominence + shoulder symmetry. Single-asset scope = no multi-asset translation curse. Helps direction quota (90.6% long-only).
Hypotheses
Implements Edwards-Magee (1948) / Bulkowski (2005) Head-and-Shoulders topology exactly: head prominence (head > shoulders x (1 + head_prominence)) enforces the head-highest signature that distinguishes H&S from Double-Top (2 equal peaks) and Triple-Top (3 equal peaks); shoulder_tolerance enforces shoulder symmetry; the neckline is fitted through the two interior troughs and extrapolated to the current bar; entry requires a decisive close-through break. Iteration-3 fix for the Layer-3 no-trades failure: the prior detector inspected only the single most-recent pivot triplet (maxima[-3:]), so a valid pattern earlier in the scan window was never seen and zero trades were produced over 2134 evaluated daily bars. The detector now scans every consecutive pivot triplet (most-recent first) and fires on the first valid, fresh, neckline-broken pattern, and thresholds were loosened modestly (finer pivots via peak_window 2, 6% shoulder tolerance, 1.5% head prominence, 0.2% break buffer, 15-bar freshness) so genuine classical patterns are captured while retaining the strict head-highest + shoulder-symmetry structure. Long+short on BINANCE futures is required because the strategy shorts on bearish H&S breaks; the short side also directly helps the portfolio's 90.6%-long-only direction quota.
Hypotheses
Negative-expectancy reversal mechanism on an adequate sample — no optimization can fix it. Over 39 trades (6 years daily BTC) the strategy loses money net of fees: expectancy -$58.93/trade, profit_factor 0.94, Sharpe -0.095, both legs failing (long WR 25%, short WR 43%). Head-and-Shoulders is a classical *reversal/contrarian* pattern that fades the prevailing move at the neckline break — the same mean-reversion class the session has repeatedly confirmed does NOT work on crypto perpetuals (the hypothesis itself cites the XRP pullback collapse as evidence). The Bulkowski '83% follow-through' figure is from mid-20th-century equities and demonstrably does not transfer to BTC perps here. This is already iteration 3, with the first two cycles spent merely getting the detector to fire (loosening shoulder_tolerance, head_prominence, freshness) rather than building any edge. Optimization tunes parameters; it cannot invert a negative edge that is symmetric across both long and short legs — a 2-hour sweep would only curve-fit an in-sample Sharpe that reverses out-of-sample. Abandon rather than optimize or iterate: the premise (chart-pattern reversal on crypto) is the flaw, not the parameters.
Implementation
Long-short single-asset Head-and-Shoulders / Inverse Head-and-Shoulders 5-element reversal on BTCUSDT.BINANCE daily bars. Detects the classical pattern: 3 local peaks with the center peak (head) clearly highest, flanked by two lower shoulders at similar heights, connected by a neckline through the two intervening troughs. Enters SHORT when the close decisively breaks below the extrapolated neckline; enters LONG on the mirror-image Inverse H&S when the close breaks above the neckline. Exits on a 5% stop, 10% profit target, or a 25-bar time-stop. Sized to 25% of equity notional on BINANCE futures (no leverage).
Verification Results
Verification failed (Layer 3 — sandbox backtest): No trades produced
Bar type used: BTCUSDT.BINANCE-1-DAY-LAST-EXTERNAL, Bars processed: 2335
Diagnostics: should_enter() returned a side 0 times over 2134 evaluated bars -> your ENTRY CONDITION never triggered. Loosen the entry logic / thresholds.
Ensure your strategy produces trades with the given data and parameters.
Backtest Review
Detector now fires correctly (39 trades, no zero-trade or min-notional drops) — the iteration-3 pivot-scan fix works mechanically
Backtest Review
Trades match the hypothesized mechanism: 23 shorts on bearish H&S, 16 longs on inverse H&S, so the code implements the premise faithfully
Backtest Review
Low exposure (20%) and modest max_drawdown depth (19%) — the losses are gradual bleed, not a blow-up
Backtest Review
Negative edge across an adequate 39-trade sample: expectancy -$58.93/trade, profit_factor 0.94, omega 0.956 — a net loser after fees
Backtest Review
Sharpe -0.095, Sortino -0.12, CAGR -0.38%, recovery_factor -0.13 — negative on every risk-adjusted measure
Backtest Review
Both legs fail independently: long_win_rate 25%, short_win_rate 43% — the pattern has no directional predictive power either way
Backtest Review
9 consecutive losses and a 1468-day (whole-backtest) max drawdown duration — no sustained profitable regime
Backtest Review
H&S is a reversal/contrarian mechanism (fade the move at neckline break) — the exact class the session has repeatedly shown fails on crypto perps; the hypothesis itself cites this
Backtest Review
Already iteration 3; prior cycles were consumed escaping a zero-trades failure, not building edge
Outcome Summary
The strategy attempted to port one of technical analysis's most famous reversal patterns — Head-and-Shoulders — onto daily BTCUSDT as a long-short system. By iteration 3 the detector was finally firing correctly (the first two cycles were spent escaping a zero-trades bug rather than building edge), producing 39 trades faithful to the hypothesized mechanism, but the results were negative on every risk-adjusted measure: -2.73% return, -0.095 Sharpe, -$58.93 expectancy, with both the long and short legs failing independently. The analyst abandoned it at the pre-optimization backtest-review gate, reasoning that no parameter sweep could invert an edge that was negative and symmetric across both directions. The decisive lesson was that the flaw lay in the premise itself — contrarian chart-pattern reversal on crypto perps — not in the parameters, so later optimization, analysis, and risk-review stages were never reached.
Outcome Summary
Classical mean-reversion/reversal chart patterns like Head-and-Shoulders fade the prevailing move and have repeatedly failed on crypto perpetuals, and the Bulkowski '83% follow-through' figure from mid-20th-century equities does not transfer to BTC.
Outcome Summary
The backtest-review analyst returned an 'abandon' verdict, judging the negative expectancy to be a symmetric, structural failure of a reversal mechanism across an adequate sample — so it was abandoned before optimization ever ran.
Outcome Summary
It tried to trade the classical Edwards-Magee Head-and-Shoulders / Inverse H&S 5-element reversal pattern on daily BTCUSDT, going short on a bearish neckline break and long on a bullish inverse-pattern break.
Outcome Summary
Over 39 trades (23 shorts, 16 longs) across ~6 years of daily bars it lost money net of fees: total return -2.73%, Sharpe -0.095, expectancy -$58.93/trade, profit factor 0.94, and a 35.9% win rate (long WR 25%, short WR 43%).
Iteration History
BtcDailyFundingExtremeNegativeSqueezeLong200Sma
Iteration History
Verification failed (Layer 2 — synthetic scenarios):
Parameters used: ['tp_pct', 'risk_pct', 'stop_pct', 'funding_pct', 'min_notional', 'min_stop_pct', 'max_hold_bars', 'per_trade_pct', 'funding_lookback', 'regime_sma_period', 'funding_tolerance_s', 'min_funding_samples']
Check that __init__ sets all attributes from self.parameters.get().
- steady_uptrend: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735701660000)
- steady_downtrend: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735701660000)
- flat_ranging: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735701660000)
- volatility_spike: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735701660000)
- zero_volume: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735701660000)
- price_gap: TypeError: FactoryStrategy._bar_ts() takes 1 positional argument but 2 were given (bar timestamp: 1735701660000)
Backtest and paper results are hypothetical. Trading involves risk of loss.