mindesbunister
96d1667ae6
feat: Complete pyramiding/position stacking implementation (ALL 7 phases)
...
Phase 1: Configuration
- Added pyramiding config to trading.ts interface and defaults
- Added 6 ENV variables: ENABLE_PYRAMIDING, BASE_LEVERAGE, STACK_LEVERAGE,
MAX_LEVERAGE_TOTAL, MAX_PYRAMID_LEVELS, STACKING_WINDOW_MINUTES
Phase 2: Database Schema
- Added 5 Trade fields: pyramidLevel, parentTradeId, stackedAt,
totalLeverageAtEntry, isStackedPosition
- Added index on parentTradeId for pyramid group queries
Phase 3: Execute Endpoint
- Added findExistingPyramidBase() - finds active base trade within window
- Added canAddPyramidLevel() - validates pyramid conditions
- Stores pyramid metadata on new trades
Phase 4: Position Manager Core
- Added pyramidGroups Map for trade ID grouping
- Added addToPyramidGroup() - groups stacked trades by parent
- Added closeAllPyramidLevels() - unified exit for all levels
- Added getTotalPyramidLeverage() - calculates combined leverage
- All exit triggers now close entire pyramid group
Phase 5: Telegram Notifications
- Added sendPyramidStackNotification() - notifies on stack entry
- Added sendPyramidCloseNotification() - notifies on unified exit
Phase 6: Testing (25 tests, ALL PASSING)
- Pyramid Detection: 5 tests
- Pyramid Group Tracking: 4 tests
- Unified Exit: 4 tests
- Leverage Calculation: 4 tests
- Notification Context: 2 tests
- Edge Cases: 6 tests
Phase 7: Documentation
- Updated .github/copilot-instructions.md with full implementation details
- Updated docs/PYRAMIDING_IMPLEMENTATION_PLAN.md status to COMPLETE
Parameters: 4h window, 7x base/stack leverage, 14x max total, 2 max levels
Data-driven: 100% win rate for signals ≤72 bars apart in backtesting
2026-01-09 13:53:05 +01:00
mindesbunister
efbe4d0c04
fix: Add TP1 TP2 SL prices to Telegram trade notifications
2026-01-07 08:39:24 +01:00
mindesbunister
ba1fe4433e
feat: Indicator score bypass - v11.2 sends SCORE:100 to bypass bot quality scoring
...
Changes:
- moneyline_v11_2_indicator.pinescript: Alert format now includes SCORE:100
- parse_signal_enhanced.json: Added indicatorScore parsing (SCORE:X regex)
- execute/route.ts: Added hasIndicatorScore bypass (score >= 90 bypasses quality check)
- Money_Machine.json: Both Execute Trade nodes now pass indicatorScore to API
Rationale: v11.2 indicator filters already optimized (2.544 PF, +51.80% return).
Bot-side quality scoring was blocking proven profitable signals (e.g., quality 75).
Now indicator passes SCORE:100, bot respects it and executes immediately.
This completes the signal chain:
Indicator (SCORE:100) → n8n parser (indicatorScore) → workflow → bot endpoint (bypass)
2025-12-26 11:40:12 +01:00
mindesbunister
358085d4f6
docs: Exit strategy analysis - losers 42x bigger than winners, dynamic thresholds rejected
...
- Created comprehensive exit strategy analysis from 30-day backtest
- Key finding: Average loss -1.84 vs average win /bin/bash.76 (42 asymmetry)
- Root cause: Position management not working, not entry quality
- Dynamic thresholds tested: only +.21/month improvement (rejected)
- Backtesting infrastructure: 487-line Python script with regime analysis
- Database: PostgreSQL integration for 78 real trades Nov 23 - Dec 23
- Next steps: Fix exit strategy, not thresholds (exits are the problem)
2025-12-23 18:01:24 +01:00
mindesbunister
0ee49703ae
chore: remove pyc artifact
2025-12-10 15:39:20 +01:00
mindesbunister
4e286c91ef
fix: harden drift verifier and validation flow
2025-12-10 15:05:44 +01:00
mindesbunister
c7f2df09b9
critical: Fix v11 missing use_quality_filters parameter + RSI index bug
...
TWO CRITICAL BUGS FIXED:
1. Missing use_quality_filters parameter (Pine Script parity):
- Added use_quality_filters: bool = True to MoneyLineV11Inputs
- Implemented bypass logic in signal generation for both long/short
- When False: only trend flips generate signals (no filtering)
- When True: all filters must pass (original v11 behavior)
- Matches Pine Script: finalSignal = buyReady and (not useQualityFilters or (...filters...))
2. RSI index misalignment causing 100% NaN values:
- np.where() returns numpy arrays without indices
- pd.Series(gain/loss) created NEW integer indices (0,1,2...)
- Result: RSI values misaligned with original datetime index
- Fix: pd.Series(gain/loss, index=series.index) preserves alignment
- Impact: RSI NaN count 100 → 0, all filters now work correctly
VERIFICATION:
- Test 1 (no filters): 1,424 signals ✓
- Test 2 (permissive RSI): 1,308 signals ✓
- Test 3 (moderate RSI 25-70/30-80): 1,157 signals ✓
Progressive sweep can now proceed with corrected signal generation.
2025-12-06 22:26:50 +01:00
copilot-swe-agent[bot]
f678a027c2
feat: Implement v11 progressive parameter sweep starting from zero filters
...
Co-authored-by: mindesbunister <32161838+mindesbunister@users.noreply.github.com >
2025-12-06 20:30:57 +00:00
mindesbunister
e97ab483e4
fix: v11 test sweep - performance fix + multiprocessing fix
...
Critical fixes applied:
1. Performance: Converted pandas .iloc[] to numpy arrays in supertrend_v11() (100x speedup)
2. Multiprocessing: Changed to load CSV per worker instead of pickling 95k row dataframe
3. Import paths: Fixed backtester module imports for deployment
4. Deployment: Added backtester/ directory to EPYC cluster
Result: v11 test sweep now completes (4 workers tested, 129 combos in 5 min)
Next: Deploy with MAX_WORKERS=27 for full 256-combo sweep
2025-12-06 21:15:51 +01:00
copilot-swe-agent[bot]
4599afafaa
chore: Add Python cache files to .gitignore and remove from repo
...
Co-authored-by: mindesbunister <32161838+mindesbunister@users.noreply.github.com >
2025-12-06 19:16:46 +00:00
copilot-swe-agent[bot]
eb0d41aed5
feat: Add v11 test sweep system (256 combinations) with office hours scheduling
...
Co-authored-by: mindesbunister <32161838+mindesbunister@users.noreply.github.com >
2025-12-06 19:15:54 +00:00
mindesbunister
7e1fe1cc30
feat: V9 advanced parameter sweep with MA gap filter (810K configs)
...
Parameter space expansion:
- Original 15 params: 101K configurations
- NEW: MA gap filter (3 dimensions) = 18× expansion
- Total: ~810,000 configurations across 4 time profiles
- Chunk size: 1,000 configs/chunk = ~810 chunks
MA Gap Filter parameters:
- use_ma_gap: True/False (2 values)
- ma_gap_min_long: -5.0%, 0%, +5.0% (3 values)
- ma_gap_min_short: -5.0%, 0%, +5.0% (3 values)
Implementation:
- money_line_v9.py: Full v9 indicator with MA gap logic
- v9_advanced_worker.py: Chunk processor (1,000 configs)
- v9_advanced_coordinator.py: Work distributor (2 EPYC workers)
- run_v9_advanced_sweep.sh: Startup script (generates + launches)
Infrastructure:
- Uses existing EPYC cluster (64 cores total)
- Worker1: bd-epyc-02 (32 threads)
- Worker2: bd-host01 (32 threads via SSH hop)
- Expected runtime: 70-80 hours
- Database: SQLite (chunk tracking + results)
Goal: Find optimal MA gap thresholds for filtering false breakouts
during MA whipsaw zones while preserving trend entries.
2025-12-01 18:11:47 +01:00
mindesbunister
cc56b72df2
fix: Database-first cluster status detection + Stop button clarification
...
CRITICAL FIX (Nov 30, 2025):
- Dashboard showed 'idle' despite 22+ worker processes running
- Root cause: SSH-based worker detection timing out
- Solution: Check database for running chunks FIRST
Changes:
1. app/api/cluster/status/route.ts:
- Query exploration database before SSH detection
- If running chunks exist, mark workers 'active' even if SSH fails
- Override worker status: 'offline' → 'active' when chunks running
- Log: '✅ Cluster status: ACTIVE (database shows running chunks)'
- Database is source of truth, SSH only for supplementary metrics
2. app/cluster/page.tsx:
- Stop button ALREADY EXISTS (conditionally shown)
- Shows Start when status='idle', Stop when status='active'
- No code changes needed - fixed by status detection
Result:
- Dashboard now shows 'ACTIVE' with 2 workers (correct)
- Workers show 'active' status (was 'offline')
- Stop button automatically visible when cluster active
- System resilient to SSH timeouts/network issues
Verified:
- Container restarted: Nov 30 21:18 UTC
- API tested: Returns status='active', activeWorkers=2
- Logs confirm: Database-first logic working
- Workers confirmed running: 22+ processes on worker1, workers on worker2
2025-11-30 22:23:01 +01:00
mindesbunister
5f7702469e
remove: V10 momentum system - backtest proved it adds no value
...
- Removed v10 TradingView indicator (moneyline_v10_momentum_dots.pinescript)
- Removed v10 penalty system from signal-quality.ts (-30/-25 point penalties)
- Removed backtest result files (sweep_*.csv)
- Updated copilot-instructions.md to remove v10 references
- Simplified direction-specific quality thresholds (LONG 90+, SHORT 80+)
Rationale:
- 1,944 parameter combinations tested in backtest
- All top results IDENTICAL (568 trades, $498 P&L, 61.09% WR)
- Momentum parameters had ZERO impact on trade selection
- Profit factor 1.027 too low (barely profitable after fees)
- Max drawdown -$1,270 vs +$498 profit = terrible risk-reward
- v10 penalties were blocking good trades (bug: applied to wrong positions)
Keeping v9 as production system - simpler, proven, effective.
2025-11-28 22:35:32 +01:00