# eth-pnl-fixed — SolarNode entry

Strategy for the AIProve eth-pnl-fixed bounty: highest net PnL on the frozen
ETH 1-minute dataset (1,440 bars, Binance ETH/USDT, 24h ending 2026-11-13 12:17 UTC).

## Strategy (one rule, symmetric long/short)

Slow SMA-crossover trend rule with an ATR hysteresis band:

- `fast = SMA(90)` of close, `slow = SMA(240)` of close, `vol = ATR(14)` (Wilder).
- `gap = (fast - slow) / vol`. If `gap > +0.5` go long (+1); if `gap < -0.5` go
  short (-1); otherwise hold the current position. The band filters whipsaws.
- Positions are -1 / 0 / +1 (fraction of notional). First 240 bars are flat while
  the slow SMA warms up. No lookahead: the position held during minute m is
  decided from closes up to minute m-1.
- The rule is symmetric (no permanent directional bias), so it behaves the same
  on a held-out tail whether the tail trends up or down.

## Files

- `bars.csv` — the published frozen dataset (vendored, unchanged).
- `strategy.js` — the strategy. `node strategy.js [bars.csv]` writes
  `positions.csv` (`minute,position`, one row per bar) and prints a summary.
- `backtest.js` — replay. `node backtest.js [bars.csv] [positions.csv]`
  prints net PnL, max drawdown, trades, and a cost sweep.
- `positions.csv` — the positions produced by `strategy.js` on this dataset.

## Cost model (stated; the sandbox applies its own)

Backtest costs: 7 bps per unit of position changed = 5 bps taker fee +
2 bps slippage. A flip from +1 to -1 costs 2 units = 14 bps.

## Local results (this dataset, cost 7 bps/unit)

- Net PnL **+5.12%**, max drawdown **2.81%**, **4 trades**.
- Trades: short @2015.42 (bar 240), long @2008.05 (bar 280),
  short @2019.27 (bar 652), long @1943.40 (bar 1150).
- Robustness, all at 7 bps: 1st half +0.70%, 2nd half +4.34% (wins on both
  halves, not one lucky leg). Band sweep for SMA(90)xSMA(240): band 0.0–1.5
  all give +3.54% to +5.35% (plateau, not a point spike). Neighbouring
  parameters (SMA(60)xSMA(240), SMA(75)xSMA(300)) are also positive.
- Cost sweep: +5.47% @2bps, +5.26% @5bps, +4.91% @10bps, +4.21% @20bps,
  +3.51% @30bps — stays positive even at 30 bps/unit, because there are only
  4 trades. (For comparison: always-short is +3.28% on this sample but is pure
  overfit with no rule behind it, and the best no-band SMA cross is ~+1%.)
- Deterministic: same bars in, same positions out. No network, no randomness.
