57 lines
2.9 KiB
Markdown
57 lines
2.9 KiB
Markdown
# Consistency Auditor Memory
|
|
|
|
## Last Audit: 2026-02-11 (Hourly Trading Update)
|
|
|
|
### CRITICAL FINDINGS
|
|
|
|
#### 1. Cooldown Timer Missing in Live Bot ❌
|
|
**Location**: backtester.rs has it (lines 40, 63, 174-179, 275-281), bot.rs missing
|
|
**Issue**: Backtester prevents whipsaw re-entry for REENTRY_COOLDOWN_BARS (7 bars) after stop-loss. Live bot can immediately re-buy on same cycle.
|
|
**Impact**: Live bot will churn more, potentially re-entering failed positions immediately. Backtest vs live divergence.
|
|
**Fix Required**: Add cooldown_timers HashMap to TradingBot, track in execute_sell, check in execute_buy.
|
|
|
|
#### 2. Gradual Ramp-Up Missing in Live Bot ⚠️
|
|
**Location**: backtester.rs has it (lines 42, 64, 196-198, 226, 508), bot.rs missing
|
|
**Issue**: Backtester limits new positions to 1 per bar during first RAMPUP_PERIOD_BARS (30 bars). Live bot could deploy all capital on first cycle.
|
|
**Impact**: Live initial deployment faster/riskier than backtest simulates.
|
|
**Fix Required**: Add new_positions_this_cycle counter to TradingBot, reset each cycle, check in execute_buy.
|
|
|
|
### Confirmed Consistent (2026-02-11)
|
|
|
|
#### Core Trading Logic ✅
|
|
- **Drawdown halt**: Time-based (35 bars), bot uses trading_cycle_count vs backtester current_bar (equivalent)
|
|
- **bars_held increment**: Both at START of trading cycle/bar (bot:660-663, bt:531-534) — previous bug FIXED
|
|
- **Position sizing**: Identical ATR volatility adjustment, confidence scaling (0.7+0.3*conf), caps
|
|
- **Stop-loss**: Identical 2.5x ATR + 4% hard cap + fixed fallback
|
|
- **Trailing stop**: Identical 1.5x ATR activation/distance + fixed fallback
|
|
- **Time exit**: Identical 30-bar threshold
|
|
- **Sector limits**: Both max 2 per sector (was 3 in daily)
|
|
- **Max positions**: Both 5 concurrent (was 8 in daily)
|
|
- **Config constants**: All parameters identical (verified config.rs)
|
|
|
|
#### Warmup Requirements ✅
|
|
**Hourly min_bars()**: max(35 MACD, 15 RSI, 100 EMA, 28 ADX, 20 BB, 63 momentum) + 5 = 105 bars
|
|
Both fetch ~158 calendar days for hourly. MACD needs slow+signal (26+9=35), ADX needs 2x (14*2=28), all accounted for.
|
|
|
|
#### Expected Differences ✅
|
|
- **Slippage**: Backtester 10 bps, live actual fills (correct)
|
|
- **Already-holding**: Different APIs, same logic
|
|
|
|
### Config (2026-02-11 Hourly)
|
|
- RISK_PER_TRADE: 0.75% (was 1% daily)
|
|
- ATR_STOP_MULTIPLIER: 2.5x (was 2.0x daily)
|
|
- ATR_TRAIL_MULTIPLIER: 1.5x
|
|
- ATR_TRAIL_ACTIVATION_MULTIPLIER: 1.5x
|
|
- MAX_CONCURRENT_POSITIONS: 5 (was 8 daily)
|
|
- MAX_SECTOR_POSITIONS: 2 (was 3 daily)
|
|
- TIME_EXIT_BARS: 30 (~4.3 days)
|
|
- REENTRY_COOLDOWN_BARS: 7 (~1 day)
|
|
- RAMPUP_PERIOD_BARS: 30 (~4.3 days)
|
|
- DRAWDOWN_HALT_BARS: 35 (~5 days)
|
|
- Partial exits REMOVED (was destroying avg win/loss ratio)
|
|
- Take profit REMOVED (was capping winners)
|
|
|
|
### Hourly Indicator Periods
|
|
RSI/MACD/ADX/BB/ATR: Standard periods (14, 12/26/9, etc) — NOT 7x scaled
|
|
Momentum: 63 (~9 days), EMA: 20/50/100. Uses textbook periods appropriate for hourly bars.
|