#!/bin/bash # Comprehensive Diagnostic Test Suite for v9 Optimization # Purpose: Identify root cause of parameter insensitivity and find real profitability improvements set -e echo "============================================================================" echo "V9 COMPREHENSIVE DIAGNOSTIC SUITE" echo "============================================================================" echo "" echo "This suite will run 3 diagnostic tests:" echo " 1. Parameter Verification - Do parameters actually affect behavior?" echo " 2. Trade Analysis - What patterns exist in winning/losing trades?" echo " 3. Profitability Analysis - Where are the real optimization opportunities?" echo "" # Configuration CSV_PATH="${1:-backtester/data/solusdt_5m.csv}" SYMBOL="SOL-PERP" if [ ! -f "$CSV_PATH" ]; then echo "❌ ERROR: CSV file not found: $CSV_PATH" echo "Usage: $0 [path/to/solusdt_5m.csv]" exit 1 fi echo "Data source: $CSV_PATH" echo "" # Ensure scripts are executable chmod +x scripts/diagnostic_sweep.py chmod +x scripts/trade_analysis.py # Test 1: Parameter Verification echo "============================================================================" echo "TEST 1: PARAMETER VERIFICATION" echo "============================================================================" echo "Testing if parameters actually control behavior..." echo "" python3 scripts/diagnostic_sweep.py \ --csv "$CSV_PATH" \ --symbol "$SYMBOL" \ 2>&1 | tee diagnostic_parameter_results.txt echo "" echo "✅ Results saved to: diagnostic_parameter_results.txt" echo "" read -p "Press Enter to continue to trade analysis..." # Test 2: Trade-Level Analysis echo "" echo "============================================================================" echo "TEST 2: TRADE-LEVEL ANALYSIS" echo "============================================================================" echo "Analyzing winning/losing trade patterns..." echo "" python3 scripts/trade_analysis.py \ --csv "$CSV_PATH" \ --symbol "$SYMBOL" \ 2>&1 | tee diagnostic_trade_results.txt echo "" echo "✅ Results saved to: diagnostic_trade_results.txt" echo "" # Summary echo "============================================================================" echo "DIAGNOSTIC SUITE COMPLETE" echo "============================================================================" echo "" echo "📊 Results Summary:" echo " - Parameter verification: diagnostic_parameter_results.txt" echo " - Trade analysis: diagnostic_trade_results.txt" echo "" echo "📋 Next Steps:" echo " 1. Review parameter verification results" echo " - If parameters have NO effect: Fix bug before optimizing" echo " - If parameters work: Continue to optimization" echo "" echo " 2. Review trade analysis for patterns" echo " - Check MAE/MFE analysis for exit improvements" echo " - Check direction analysis for threshold adjustments" echo " - Check exit strategy recommendations" echo "" echo " 3. Create focused optimization plan based on findings" echo "" echo "============================================================================"