#!/bin/bash
# View MT5 HTML report as text (no browser needed)
REPORT_PATH="$1"
if [ -z "$REPORT_PATH" ]; then
echo "Usage: $0 "
echo ""
echo "Or find reports automatically:"
find ~/mt5-docker/config/.wine/drive_c/ -name "*.htm" -type f 2>/dev/null | head -5
exit 1
fi
if [ ! -f "$REPORT_PATH" ]; then
echo "Report not found: $REPORT_PATH"
exit 1
fi
echo "=== MT5 Trading Report ==="
echo "File: $REPORT_PATH"
echo ""
# Extract key data from HTML
# Account info
echo "--- Account Info ---"
grep -oE "Account:[^<]+" "$REPORT_PATH" 2>/dev/null | head -1
grep -oE "Name:[^<]+" "$REPORT_PATH" 2>/dev/null | head -1
grep -oE "Balance:[^<]+" "$REPORT_PATH" 2>/dev/null | head -1
grep -oE "Profit:[^<]+" "$REPORT_PATH" 2>/dev/null | head -1
echo ""
echo "--- Trade Summary ---"
grep -oE "Total Net Profit:[^<]+" "$REPORT_PATH" 2>/dev/null
grep -oE "Gross Profit:[^<]+" "$REPORT_PATH" 2>/dev/null
grep -oE "Gross Loss:[^<]+" "$REPORT_PATH" 2>/dev/null
grep -oE "Total Trades:[^<]+" "$REPORT_PATH" 2>/dev/null
grep -oE "Winning Trades:[^<]+" "$REPORT_PATH" 2>/dev/null
grep -oE "Losing Trades:[^<]+" "$REPORT_PATH" 2>/dev/null
echo ""
echo "--- For full HTML, use ---"
echo "cat '$REPORT_PATH' | less"