v2.0April 2026
01 — System OverviewArchitecture & Stack
Architecture
FrameworkNext.js 16.1.7
DatabasePostgreSQL (pg Pool)
ExchangeHyperliquid Perps API
ModePaper Trading
Tick Interval30 seconds
Coins per Tick5 (rotating top 25)
Key Metrics
Agents7 (3 leading, 3 confirming, 1 filter)
Backtest Strategies92
Leverage20×
Starting Balance$100
Max Positions8 simultaneous
Fee Model0.035% taker/side
02 — Signal Generation7-Agent Composite Engine
Each tick, 7 specialized agents independently analyze market data, producing scores from -1 (strong short) to +1 (strong long). These are combined into a single composite signal.
| Agent | Weight | Role | Accuracy | Internals |
|---|---|---|---|---|
| SMC | 22% | LEADING | 71% | Order blocks, FVG, BOS |
| Liquidity | 18% | LEADING | 33% | L2 imbalance × 0.45 + wall × 0.25 + depth × 0.30 |
| Volatility | 16% | FILTER | 36% | BB width + ATR — context/sizing, not direction |
| Volume | 14% | CONFIRMING | 45% | VWRSI 30% + VWAP-dev 30% + CVD 25% + trend 15% |
| Orderflow | 10% | LEADING | 12% | VPIN + delta + Kyle's Lambda (DEMOTED) |
| Trend | 10% | CONFIRMING | 40% | EMA cross 30% + EMA50 25% + VIDYA 45% × ADX |
| Momentum | 10% | CONFIRMING | 20% | RSI(5) 45% + RSI(14) 25% + Williams %R 30% |
Accuracy-driven reweight (Apr 5): SMC 71% → highest weight. Orderflow was 28% weight but only 12% accurate (anti-predictive) → demoted to 10%. 100% agent agreement = 0% WR — high agreement is groupthink, not conviction.
Composite Score Pipeline
// Step 1: Weighted average (SMC zero-skipped if |score| < 0.01) normalizedScore = Σ(weight[i] × score[i]) / Σ(weight[i]) // Step 2: tanh amplification — raw ±0.07 → usable range amplified = tanh(normalizedScore × 3.0) × 0.8 // Step 3: Agreement analysis (NEUTERED — groupthink = losses) ≥83% agreement → 1.0× (NO boost) ≥67% agreement → 1.1× ≥50% agreement → 1.05× // Step 4: Disagreement penalty (≥3 bulls AND ≥3 bears) penalty = 1.0 - (splitRatio × 0.3) // Step 5: Final score clipped to [-1, +1] → mapped to 0-100
Conviction Tiers
| Tier | Score ≥ | Allowed | Notes |
|---|---|---|---|
| S | 82 | YES | 48.4% WR after reweight (was 0%) |
| A | 72 | YES | Primary entry tier |
| B | 62 | YES | Lower confidence, smaller size |
| C | 40 | BLOCKED | 75% of losing trades were C-tier |
| D | <40 | BLOCKED | Noise |
03 — Entry LogicChampion Strategy + MTF Confirmation
The system uses a champion strategy — the single best-performing strategy from backtesting — as the primary entry. The 7-agent composite path is currently disabled.
Champion: RSI Divergence Wide + Chandelier Exit
Long signal requires ALL of:
- Price below 10-20 bar lookback × 0.997 (price dipped)
- RSI improved by 5+ points from recent low (momentum turning)
- RSI still < 35 (oversold territory)
- Volume z-score > 0.3 (above-average volume confirms)
Sharpe6.12
Max DD4.4%
Coins +7/7
Max Hold200 bars (~16.7h)
MTF Confirmation — Elder Triple Screen
Best MTF Strategy:
mtf_mean_rev_1h4h — Mean Rev (RSI<28 + BB%B<0.15) with 1h EMA trend + 4h RSI confirmation. Result on 1h: 60.7% WR, Sharpe 6.0, MaxDD 7.8%, PF 5.5MTF works on 1h, NOT on 15m (too noisy for synthetic HTF bars). Timeframe ranking: 1h >> 15m >> 5m.
Entry Gate Conditions
| Check | Condition | Purpose |
|---|---|---|
| Position Limit | openPositions < 8 | Prevent over-exposure |
| Margin Check | requiredMargin ≤ available equity | Can't trade without margin |
| Cooldown | timeSince ≥ 300s (5min) | Prevents fee drag (was 829%) |
| Slippage | estimatedSlippage ≤ 10 bps | Skip illiquid moments |
| Tier Filter | tier ∈ {S, A, B} | C/D blocked — 75% of losses |
| Regime Block | regime ≠ "range" | Range = 50%+ losses |
| Allocation Cap | totalMargin ≤ 50% equity | Prevent full exposure |
04 — Exit LogicChandelier Trail + Multi-TP
ATR-based trailing stop that dynamically tightens as profit grows. Named after a chandelier hanging from the highest point.
Phase 1
Wait
0 → +0.15%
Phase 2
Trail Wide
+0.15% → +1.5% | 3.0× ATR
Phase 3
Trail Tight
> +1.5% | 2.0× ATR
| Param | Value | Description |
|---|---|---|
| initATR | 3.0 | Initial trail = 3× ATR from peak |
| tightATR | 2.0 | Tightened trail after profit threshold |
| tightenAt | 1.5% | Profit level to tighten |
| activateAt | 0.15% | Min profit to activate trail |
| emergencySL | -5.0% | Hard stop if trail inactive |
| maxHold | 200 bars | Force exit ~16.7h on 5m |
Multi-TP loses money: Even at 70% WR, partial close caps upside (+0.15% blended) while emergency SL takes full loss (-3%). Net: -0.795%/trade. Confirmed by Dave Mabe research + Lopez de Prado Triple Barrier.
Exit Reason Legend
TP / TP3 — Take profitCHANDELIER — Trail triggeredBE_STOP — BreakevenSL / EMERGENCY — Stop lossTIMEOUT — Max hold
05 — Position Sizing6-Multiplier Pipeline
Position size = product of 6 independent multipliers. Each ranges 0.1-1.0, so worst case stacks conservatively.
notional = (positionSizePct / 100) × equity × leverage × sizeMult sizeMult = tierSize × hmmRisk × healthMult × mcMult × metaMult × layerMult // Best case (S-tier, calm_bull, healthy, low ruin): sizeMult = 1.0 × 1.0 × 1.0 × 1.0 = 1.0 → $320 // Worst case (B-tier, volatile_bear, poor health, high ruin): sizeMult = 0.5 × 0.3 × 0.5 × 0.5 = 0.0375 → $12
HMM Risk Multiplier
calm_bull1.0 (full risk)
volatile_bull0.7
calm_bear0.5
volatile_bear0.3
crisis0.1
MC Size Multiplier (Ruin-Based)
Ruin > 30%0.3 (very dangerous)
Ruin > 20%0.5 (risky)
Ruin > 10%0.7
Ruin > 5%0.85
Ruin ≤ 5%1.0 (healthy)
06 — HMM Regime Detection5-State Hidden Markov Model
A Hidden Markov Model classifies market conditions into 5 regimes, affecting position sizing, agent weights, and entry decisions.
Calm Bull
1.0×
Vol. Bull
0.7×
Calm Bear
0.5×
Vol. Bear
0.3×
Crisis
0.1×
HMM Configuration
States5 (calm_bull, calm_bear, volatile_bull, volatile_bear, crisis)
Observations6 bins (big_down, small_down, flat, small_up, big_up, extreme)
Transition MatrixSticky — high self-transition (60-70%)
Adaptive LearningUpdates every 100 observations (70% data / 30% prior)
State PersistenceSerialized to PostgreSQL agent_state KV
Regime effects: Agent weights shift per regime (e.g., trend +4% in low_vol_trend, -4% in range). Range regime is fully blocked from entries.
07 — Self-Learning System4-Layer Adaptive Pipeline
L0
Monte Carlo — every optimizer cycle
5K sims × 300 trades. Ruin probability, Kelly fraction, mcSizeMultiplier. Per-agent dominance + exclusion test → contribution scores.
L1
Statistical Optimizer — every 25 trades — FROZEN
6 analyses: per-regime threshold, per-tier sizing, agent accuracy, TP/SL ratio, side bias, cooldown. Anti-oscillation: frozen if param flips 3+ times.
L2
LLM Review — every 100 trades
Qwen3-235B via OpenRouter. JSON proposals validated by CPCV. Rejects ALL if JSON parse fails.
L3
Signal Tracker — every tick per coin
Per-agent signal → outcome. Accuracy matrix per agent × regime × side. Pruned to 7 days on boot.
Health Size Multiplier (Circuit Breaker)
>60 → 1.0×>40 → 0.8×>25 → 0.5×≤25 → 0.15×
Circuit breaker disabled by default. Health multiplier is always 1.0 unless manually enabled. Optimizer is FROZEN pending backtest validation.
08 — Backtest ResultsApril 2026 Analysis
| Strategy | TF | WR% | Sharpe | MaxDD | PF | Verdict |
|---|---|---|---|---|---|---|
| MTF Mean Rev 1h+4h | 1h | 60.7% | 6.0 | 7.8% | 5.5 | BEST RISK-ADJ |
| Champion (Chand F+L) | 5m | — | 6.12 | 4.4% | — | PRODUCTION |
| Combo RSI+Multi+Ratchet | 1h | — | — | — | — | $600+ on 1h |
| Multi-TP Standard | any | 65-70% | <0 | >15% | <1.0 | LOSES MONEY |
Timeframe Comparison
5m
Noisy
High fee drag
15m
Mixed
Too noisy for MTF
1h
OPTIMAL
Best for MTF
4h
HTF Filter
Not for entries
09 — Live ConfigurationCurrent Parameters
Scalping Defaults
Entry Threshold0.08 (was 0.04)
Position Size16% (was 12%)
Max Hold1800s / 30min (was 3600s)
Stop Loss0.25% (was 0.5%)
Take Profit0.40% (was 1.5%)
Leverage20×
Cooldown300s / 5min (was 120s)
Risk Controls
Max Allocation50% of equity as margin
Max Positions8 simultaneous
Circuit BreakerDisabled
OptimizerFrozen
Allowed TiersS, A, B (C/D blocked)
Range RegimeBlocked
HedgingEnabled (same coin L+S)
Config persistence:
this.params stored in PostgreSQL agent_state KV — survives redeploys. Code defaults only apply on first run or hard reset. Use updateParams API for live changes.10 — Complete Trade LifecycleFull 9-Step Pipeline
1
Market DataFetch candles + L2 orderbook from Hyperliquid for 5 coins (rotating top 25)
2
HMM RegimeObserve return → quantize → forward algorithm → 5-state belief. Range → SKIP.
3
Champion EvalRun rsiDivergenceWide on 5m candles. Signal with TP 99%, SL 5.0%.
4
Entry Gate7 checks: position limit, margin, cooldown, slippage, tier, regime, allocation.
5
Size Compute16% × equity × 20× × (hmmRisk × mcMult × healthMult). Check margin.
6
Position OpenRecord to PostgreSQL. Deduct 0.035% taker fee.
7
Manage LoopEvery tick: emergency SL → timeout → Chandelier trail → TP check.
8
Position CloseRecord PnL, deduct exit fee, move to trades table, feed to signal tracker.
9
Learning CycleEvery 25 trades: MC + Optimizer. Every 100: LLM review. Every tick: signal tracker.
Playground Trading System Documentation — v2.0 — April 2026
92 Strategies | 7 Agents | 5-State HMM | 4-Layer Self-Learning
92 Strategies | 7 Agents | 5-State HMM | 4-Layer Self-Learning