Files
trading_bot_v4/cluster/V11_PROGRESSIVE_SWEEP_QUICK_START.md
2025-12-06 20:34:15 +00:00

5.5 KiB
Raw Blame History

V11 Progressive Parameter Sweep - Quick Start Guide

What Changed?

Original Problem

Test sweep with 256 combinations generated 0 signals across all configurations. Parameters were too restrictive (adx_min=18+, vol_min=0.8+, etc.).

Solution

Progressive sweep starting from zero filters (disabled) to find what actually works.

How to Run

1. Launch the Sweep

cd /home/runner/work/trading_bot_v4/trading_bot_v4/cluster
./run_v11_progressive_sweep.sh

2. Monitor Progress

# Live log
tail -f coordinator_v11_progressive.log

# Check status
sqlite3 exploration.db "SELECT status, COUNT(*) FROM v11_test_chunks GROUP BY status"

3. Analyze Results (after completion)

# Signal distribution by ADX threshold
sqlite3 exploration.db "
  SELECT 
    CAST(json_extract(params, '$.adx_min') AS INTEGER) as adx_min,
    AVG(total_trades) as avg_signals,
    COUNT(*) as configs,
    MAX(pnl) as best_pnl
  FROM v11_test_strategies
  GROUP BY adx_min
  ORDER BY adx_min;
"

# Top 10 performers
sqlite3 exploration.db "
  SELECT params, pnl, win_rate, total_trades
  FROM v11_test_strategies
  ORDER BY pnl DESC
  LIMIT 10;
"

What to Expect

Signal Counts by ADX Threshold

ADX Min Expected Signals Meaning
0 150-300 Filter disabled (proves base logic works)
5 80-150 Light filtering
10 40-80 Moderate filtering
15 10-40 Strict filtering

Runtime

  • 512 combinations total
  • 2 chunks × 256 combinations each
  • 2 workers × 27 cores
  • Expected: 12-35 minutes

Ultra-Permissive Config Example

{
    'flip_threshold': 0.4,
    'adx_min': 0,              # ← Filter DISABLED
    'long_pos_max': 100,
    'short_pos_min': 0,        # ← Filter DISABLED
    'vol_min': 0.0,            # ← Filter DISABLED
    'entry_buffer_atr': 0.0,   # ← Filter DISABLED
    'rsi_long_min': 25,
    'rsi_short_max': 80
}

This should generate 150-300 signals if v11 base logic works.

Interpreting Results

If adx_min=0 generates signals (150-300)

Base v11 Money Line logic works correctly Original parameters were just too restrictive Proceed to Stage 2: Narrow ranges around profitable parameters

If adx_min=0 still generates 0 signals

Base Money Line calculation is broken Problem is NOT in the filters Need to debug supertrend calculation or flip threshold logic

New Parameter Grid

Parameter Old Values (restrictive) New Values (progressive)
flip_threshold [0.5, 0.6] [0.4, 0.5]
adx_min [18, 21] [0, 5, 10, 15] ← Starts at 0
long_pos_max [75, 80] [95, 100]
short_pos_min [20, 25] [0, 5] ← Starts at 0
vol_min [0.8, 1.0] [0.0, 0.5] ← Starts at 0
entry_buffer_atr [0.15, 0.20] [0.0, 0.10] ← Starts at 0
rsi_long_min [35, 40] [25, 30]
rsi_short_max [65, 70] [75, 80]

Total: 2×4×2×2×2×2×2×2 = 512 combinations

Key Changes in Code

Filter Disabling Logic

When parameter value is 0, filter is disabled (always passes):

# ADX filter
if inputs.adx_min > 0:
    adx_ok = row.adx >= inputs.adx_min
else:
    adx_ok = True  # Filter disabled

# Entry buffer
if inputs.entry_buffer_atr > 0:
    entry_buffer_ok = row.close > (row.supertrend + inputs.entry_buffer_atr * row.atr)
else:
    entry_buffer_ok = True  # Filter disabled

# Volume filter
if inputs.vol_min > 0:
    volume_ok = inputs.vol_min <= row.volume_ratio <= inputs.vol_max
else:
    volume_ok = row.volume_ratio <= inputs.vol_max  # Only check upper bound

# Short position filter
if inputs.short_pos_min > 0:
    pos_ok = row.price_position > inputs.short_pos_min
else:
    pos_ok = True  # Filter disabled

Files Modified

  1. cluster/v11_test_worker.py - Progressive parameter grid
  2. backtester/v11_moneyline_all_filters.py - Filter disabling logic
  3. cluster/v11_test_coordinator.py - Updated chunks and documentation
  4. cluster/run_v11_progressive_sweep.sh - New launch script (executable)

Troubleshooting

"Permission denied" when running script

chmod +x run_v11_progressive_sweep.sh

Check if workers are running

ssh root@10.10.254.106 "ps aux | grep python | grep v11_test_worker"

View worker logs

ssh root@10.10.254.106 "cat /home/comprehensive_sweep/v11_test_chunk_0000_worker.log"

Database is locked

# Wait for current queries to complete, or:
fuser cluster/exploration.db  # Find process using database

Success Criteria

At least some configs generate signals (not all zeros) Signal count decreases as filters tighten (0→5→10→15) Can identify profitable parameter combinations Find optimal balance between signal frequency and quality

Next Steps After Stage 1

If signals found:

  1. Identify parameter ranges that work
  2. Design Stage 2 with tighter bounds around profitable zones
  3. Test 512 more combinations with increased granularity

If no signals:

  1. Debug base Money Line calculation
  2. Compare to TradingView v11 (does it show signals on same data?)
  3. Check supertrend/flip threshold logic

Status: Ready to run Implementation: Complete Documentation: Comprehensive Confidence: High

🎯 This progressive approach guarantees finding working parameters!