Add MT5 safety tools to prevent MetaEditor freezes
- check-syntax.sh: Pre-compilation syntax checker for MT4→MT5 issues - metaeditor-watchdog.sh: Auto-kills stuck MetaEditor processes - safe-compile.sh: Wrapper with 2-minute timeout for compilations These tools help prevent the container freeze that occurred when trying to compile OrdersEA with 100 MT4 syntax errors.
This commit is contained in:
37
scripts/check-syntax.sh
Executable file
37
scripts/check-syntax.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# Syntax checker for MQL5 files before compilation
|
||||
|
||||
FILE="$1"
|
||||
|
||||
if [ -z "$FILE" ]; then
|
||||
echo "Usage: $0 <filename.mq5>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== Checking $FILE for obvious MT4→MT5 conversion issues ==="
|
||||
|
||||
echo ""
|
||||
echo "MT4 functions that won't work in MT5:"
|
||||
grep -n "OrderSend(\|OrderClose(\|OrderSelect(\|MarketInfo(\|WindowExpertName(\|IsOptimization(" "$FILE" | head -10
|
||||
|
||||
echo ""
|
||||
echo "Global variables that should be functions in MT5:"
|
||||
grep -n "\bBid\b\|\bAsk\b\|\bDigits\b\|\bPoint\b" "$FILE" | grep -v "SymbolInfoDouble\|SymbolInfoInteger" | head -10
|
||||
|
||||
echo ""
|
||||
echo "Ticket types (should be ulong, not int):"
|
||||
grep -n "int.*ticket\|int.*Ticket" "$FILE" | head -5
|
||||
|
||||
echo ""
|
||||
echo "WinAPI includes (will fail in Wine/MT5):"
|
||||
grep -n "WinAPI\|winuser\|WinUser" "$FILE"
|
||||
|
||||
echo ""
|
||||
echo "=== Quick Fix Check ==="
|
||||
ERRORS=$(grep -c "OrderSelect(\|MarketInfo(\|WindowExpertName(\|IsOptimization(" "$FILE" 2>/dev/null)
|
||||
if [ "$ERRORS" -gt 0 ]; then
|
||||
echo "⚠️ WARNING: Found $ERRORS MT4-only functions!"
|
||||
echo "This file will NOT compile in MT5. It needs conversion."
|
||||
else
|
||||
echo "✅ No obvious MT4 functions found"
|
||||
fi
|
||||
Reference in New Issue
Block a user