This is the whole system: HA math, A-filter (retired), frozen backtest JSON, hazard tables, live DIP BUY gates, ETH+LINK SMA, Holdouts RS, and what to ask Claude. Copy it. Paste it. Tell it to re-backtest and improve — not to invent fills.
# HA Pulse — full strategy spec for backtest / critique / improvement
You are a quantitative researcher. Reproduce, stress-test, and improve this system.
Do not invent fills or HA bars. Use closed bars only. State every leak.
## 0. What this desk is
A Heikin Ashi (HA) reversal / relative-strength desk for liquid USDT perps.
- Live scanner: ~50 names, OKX USDT-SWAP klines (Bitget fallback).
- Backtest book: 39 names, Binance **spot** monthly/weekly, 2017–2026.
- Live venue ≠ test venue. Swap vs spot can differ ~0–4% on a month. Treat as a filter book, not a proven live edge.
Apps on the desk:
1. **Blotter** — monthly HA idea + weekly confirm + stay-%.
2. **Call** — unified play: DIP BUY only if month green AND week green AND BTC week green AND price within 3.5% of mapped support.
3. **Charts** — regular OHLC (Bollinger 20,2 lines + Fib lines) next to HA (EMA 20/50/100).
4. **Holdouts** — relative strength vs median coin and vs BTC on 24h / 7d / 30d.
5. **ETH+LINK SMA** — 2 green weekly HA + close > SMA20 + BTC weekly green; wait ≤2 weeks for pullback to SMA (or close within 2%); else chase week-3 open; exit red HA or 5 weeks; kill −25%.
## 1. Universe (live default)
BTC ETH SOL BNB XRP DOGE ADA AVAX LINK SUI TON TRX DOT LTC BCH ATOM NEAR APT UNI AAVE MKR LDO CRV ARB OP STRK INJ SEI TIA FIL STX IMX HYPE ONDO ENA PENDLE JUP JTO PYTH TAO RENDER FET WLD POL GRT ICP PEPE WIF BONK FLOKI SHIB TRUMP ORDI
Backtest used 39 overlapping majors (spot). Do not silently add memecoins to the historical book.
## 2. Heikin Ashi (canonical, causal)
For each OHLC bar i:
```
HA_close[i] = (O + H + L + C) / 4
HA_open[0] = (O + C) / 2
HA_open[i] = (HA_open[i-1] + HA_close[i-1]) / 2
HA_high[i] = max(H, HA_open, HA_close)
HA_low[i] = min(L, HA_open, HA_close)
```
Wick test (shaved): `|HA_open − HA_low| ≤ scale * 1e-8` (bull) or `|HA_open − HA_high| ≤ scale * 1e-8` (bear), scale = max(|a|,|b|,1).
Candle type:
- +2 strong bull: HA_close > HA_open AND no lower wick
- +1 weak bull: HA_close > HA_open AND lower wick
- −2 strong bear: HA_close < HA_open AND no upper wick
- −1 weak bear: HA_close < HA_open AND upper wick
- 0 doji: HA_close == HA_open
**Color streak:** consecutive same-color HA (weak counts). Doji resets to 0.
**Trigger (strong-run):** only +2 / −2 increment. First strong after opposite color starts trigger at ±1. Weak does not start or increment trigger. When color flips, prevTrigger is stored as the length of the just-ended strong run (signed).
**Stronger body:** |HA_close − HA_open| > previous bar body.
**Forming bar:** last candle whose period has not closed (UTC). Live desk paints it. Backtest **must drop** the forming last bar. A forming month is a watch, never a fill.
## 3. A-filter (locked N=4) — RETIRED for live size
Settings:
- buyRevThresh = 4, sellRevThresh = 4
- requireStrongerBody = false (optional filter)
A-long (major-buy):
```
currentTrigger == +1
AND prevTrigger <= -4
AND weekly trigger > 0 # last WEEK already closed by the month close
AND month is CLOSED
```
Fill = **next month open** (spot/swap close-to-open as you define; document it).
Exit = first opposite-color monthly HA **close**.
Costs = 8 bps round-trip in the frozen book.
A-short (first strong red after ≥4 strong green): **do not take**. Median −18%.
Rules that failed:
- Fade the 4th green month (short while still green).
- Buy a still-red 4th month as “the squeeze.”
- First green after a short red run (<4). Fat right tail, negative median.
## 4. Frozen backtest (do not overwrite — re-run and compare)
Sample: 39 names, closed monthly HA, 8 bps, forming last bar dropped. Weekly = last week that had already closed by month close.
| Idea | n | win | avg | median | PF | Call |
|---|---|---|---|---|---|---|
| A-long N=4, weekly green | 34 | 35.3% | +5.2% | −9.9% | 1.41 | Retired. BTC beta. |
| A-long, weekly not green | 11 | 27.3% | −14.7% | −12.2% | 0.10 | Loser. Do not take. |
| First strong red after 4 green | 35 | 28.6% | −0.6% | −17.7% | 0.97 | Fail. |
| Short 4th green month | 51 | 47.1% | +0.6% | −2.7% | 1.05 | Dead after costs. |
| Buy still-red 4th month | 115 | 47.0% | +2.7% | −0.5% | 1.36 | Not the reversal. |
| Early first-green (<4 red) | 114 | 43.0% | +98% | −7.6% | 9.20 | Lottery / listing tail. |
| A-long weekly, OOS 2023+ | 27 | 33.3% | +8.2% | −9.9% | 1.75 | Same median. |
A-filter vs BTC (same hold):
- n=34 prints, **14 distinct months**, **14/34 are Feb 2023**
- alpha = −17.6% (SE 10%, t=−1.76), beta=0.72, R²=0.27
- 31/34 fired while BTC monthly was already green
- Independent n is 14 months, not 34 names
Block bootstrap (resample 14 months, 10k):
- mean: 5th −13.1%, 50th +3.8%, 95th +34%
- median: 5th −20.4%, 50th −9.9%, 95th +20.1%
- win rate: 5th 17.9%, 50th 34.6%, 95th 56.5%
- PF: 5th 0.20, 50th 1.30, 95th 4.54
Verdict: A-filter does not survive. Levered BTC beta with extra steps. **Not a live size.**
JSON:
```json
{
"longN4Weekly": {"n":34,"wr":0.353,"avg":0.052,"med":-0.099,"pf":1.41},
"longN4NoWeekly": {"n":11,"wr":0.273,"avg":-0.147,"med":-0.122,"pf":0.1},
"shortN4": {"n":35,"wr":0.286,"avg":-0.006,"med":-0.177,"pf":0.97},
"fadeGreen4": {"n":51,"wr":0.471,"avg":0.006,"med":-0.027,"pf":1.05},
"fadeRed4": {"n":115,"wr":0.47,"avg":0.027,"med":-0.005,"pf":1.36},
"earlyLong": {"n":114,"wr":0.43,"avg":0.98,"med":-0.076,"pf":9.2},
"gate": {"aLongN":34,"distinctMonths":14,"feb2023N":14,"alpha":-0.176,"beta":0.723,"r2":0.269,"tAlpha":-1.76}
}
```
## 5. Monthly HA color hazard (closed bars, 39 names)
P(next month same color | N months in a row). This is NOT a squeeze signal.
Red (down) runs:
N=1 seen=317 cont=85% flip=15%
N=2 267 79/21
N=3 204 85/15
N=4 173 82/18
N=5 142 81/19
N=6 115 78/22
N=7 89 73/27
N=8 65 85/15
N=9 55 89/11
N=10 49 73/27
N=11 30 80/20
N=12 22 82/18
N=13 18 72/28
N=14 13 69/31
Green (up) runs:
N=1 310 75/25
N=2 229 70/30
N=3 161 73/27
N=4 118 71/29
N=5 84 62/38
N=6 52 63/37
N=7 33 42/58
N=8 14 57/43
Completed red runs (length the month it flipped green): most flips at 1–4m (56% of runs). 11m red is rare (2% of flips) and still had ~80% chance of one more red.
Daily/weekly stay-% on the desk is **per-coin** (runsHazard on that coin’s HA). Monthly stay-% uses this **all-coin** table.
## 6. Live Call — DIP BUY (not backtested as a system)
Decision tree (must all agree — otherwise WAIT):
DIP BUY iff:
1. Monthly HA color streak > 0 (month still green)
2. Weekly HA color streak > 0
3. BTC weekly HA color streak > 0 (BTC week green — gate)
4. Price is a **dip**: within 3.5% above nearest support
Else if at resistance (within 2.5% below nearest resistance): WAIT, don’t chase.
Else if 1–3 all true but not at support: HOLD LONG — wait for the dip at that support.
Else if month and week red: HOLD SHORT (no long; don’t fade the first bounce).
Else: WAIT.
Support / resistance (from daily OHLC + weekly/monthly prior closed H/L):
- SMA20, SMA50 of daily close
- 2-bar swing pivots (last swing low below / high above)
- Prior closed week high/low, prior closed month high/low
- Fib 38.2 / 50 / 61.8 of last swing high→low
- Cluster levels within 1.2% of each other
This live rule is **not** in the frozen A-filter book. If you backtest it, label it “DIP-BUY v1”, closed bars only, fill next session open after the four gates are true on a **closed** day.
## 7. ETH+LINK weekly SMA (separate page)
Universe: ETH, LINK only. BTC is a gate, not a trade.
Signal: 2 consecutive green weekly HA AND weekly close > SMA20(weekly close) AND BTC weekly HA green.
Entry:
- Wait ≤2 weeks for pullback: week low ≤ SMA or close within 2% of SMA.
- If none, chase week-3 open.
Exit: red weekly HA close, OR 5 weeks held, OR −25% from entry (kill). Still on if none fire.
Phases: idle → signal-forming → wait-1 → wait-2 → chase → long → stopped/exited.
## 8. Holdouts (relative strength)
For each alt (exclude BTC):
- retD = close / close[1] − 1
- retW = close / close[7] − 1
- retM = close / close[30] − 1
- typical = **median** of alts on that clock
- RS = ret − typical
- vsBTC = retW − BTC retW
- agree = count of clocks where RS > 0 (0–3)
- Thin = 24h quote volume ≤ 25th percentile of the pack
Prefer agree 3/3. Thin is a warning (noise / illiquid).
## 9. Positioning (live only, not in backtest)
- Funding: OKX swap funding rate; Bitget fallback. Negative funding + shorts = squeeze **candidate**, not a buy by itself.
- L/S: OKX long-short **account** ratio. <0.85 crowded short ( paler green ). >1.3 crowded long.
- OI USD + Δ 1D / 1W / 1M from OKX OI history.
- Market cap: CoinGecko /coins/markets by symbol (cached 5 min). ROI ladder = price * (targetCap / currentCap). No dilution/unlocks.
“11 months HA red” ≠ “heavily shorted.”
## 10. Flip level (HA)
For current HA bar: color flips if close crosses **thisOpen** (HA open of the live candle). Distance = (close − thisOpen) / close. Alerts fire if |gap| ≤ 2%.
## 11. What is true / what is not
True:
- Unconfirmed first-green (weekly not green) is a loser (PF 0.10).
- First-red shorts after a long green are losers (median −18%).
- Fading month-4 green is dead after 8 bps.
- A-filter vs BTC has negative alpha; cluster in Feb 2023.
- Long red HA runs usually continue; 11m red still ~80% stay.
Not true / not proven:
- A-long with weekly green is a live edge.
- Stay-% ≥ 80% means you make money (it means next HA candle is likely the same **color**).
- DIP BUY four-gate has a published expectancy (it does not).
## 12. Your job
1. Re-backtest A-filter on **closed** monthly HA, 8 bps, fill next month open, exit first opposite HA color. Compare to the JSON above. Flag any mismatch > 2 trades or > 2pp median.
2. Propose **one** improvement that is not “add more indicators.” Prefer: BTC-month gate, skip Feb-cluster regime, vol/turnover floor, or DIP-BUY v1 on **daily** closed bars with the four gates.
3. Report n, distinct months, win, mean, median, PF, max DD, alpha vs BTC (same hold), and a month-block bootstrap 5/50/95.
4. Do not recommend live size unless median > 0 **and** bootstrap 5th mean > 0 **and** distinct months ≥ 20.
5. Output: (a) verdict in one paragraph a non-quant can read, (b) tables, (c) exact new rule in code-like pseudocode.
Paper only. Not financial advice.