#!/bin/bash # Run optimal exit analysis and save results # Usage: ./run_exit_analysis.sh OUTPUT_FILE="exit_analysis_results_$(date +%Y%m%d_%H%M%S).txt" echo "🔍 Running optimal exit level analysis..." echo "Results will be saved to: $OUTPUT_FILE" echo "" # Run the SQL analysis docker exec trading-bot-postgres psql -U postgres -d trading_bot_v4 -f scripts/analyze_optimal_exits.sql | tee "$OUTPUT_FILE" echo "" echo "✅ Analysis complete!" echo "📊 Results saved to: $OUTPUT_FILE" echo "" echo "Next steps:" echo "1. Review the output above" echo "2. Look for patterns in MFE/MAE distribution" echo "3. Check if quality score correlation is strong" echo "4. Decide on optimal TP1/TP2/SL levels" echo "5. Update config/trading.ts with new settings"