Add n8n workflow and validation script for settings monitoring; fix missing weekend protection params

This commit is contained in:
2026-03-30 13:08:12 -04:00
parent 0d026d5573
commit 0719ecdc4d
23 changed files with 707 additions and 0 deletions

View File

@@ -39,3 +39,7 @@ InpMinADX=20.0 ; Standard trend strength
InpMagicNumber=777777 InpMagicNumber=777777
InpSlippage=3 InpSlippage=3
InpDebugMode=false InpDebugMode=false
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -39,3 +39,7 @@ InpMinADX=23.0 ; Moderate trend strength
InpMagicNumber=777775 InpMagicNumber=777775
InpSlippage=4 InpSlippage=4
InpDebugMode=false InpDebugMode=false
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -34,3 +34,7 @@ InpMinADX=22.0
InpMagicNumber=777773 InpMagicNumber=777773
InpSlippage=5 ; Higher slippage tolerance InpSlippage=5 ; Higher slippage tolerance
InpDebugMode=false InpDebugMode=false
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -35,3 +35,7 @@ InpMinADX=21.0
InpMagicNumber=777778 InpMagicNumber=777778
InpSlippage=4 InpSlippage=4
InpDebugMode=false InpDebugMode=false
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -35,3 +35,7 @@ InpMinADX=22.0 ; Moderate trend strength
InpMagicNumber=777776 InpMagicNumber=777776
InpSlippage=4 InpSlippage=4
InpDebugMode=false InpDebugMode=false
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -39,3 +39,7 @@ InpMinADX=25.0 ; Higher - need strong trend
InpMagicNumber=777779 InpMagicNumber=777779
InpSlippage=3 InpSlippage=3
InpDebugMode=false InpDebugMode=false
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -34,3 +34,7 @@ InpMinADX=20.0
InpMagicNumber=777774 InpMagicNumber=777774
InpSlippage=10 ; High slippage tolerance for gold InpSlippage=10 ; High slippage tolerance for gold
InpDebugMode=false InpDebugMode=false
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -47,3 +47,7 @@ InpMaxDailyDrawdown=2.5
; === EA Settings === ; === EA Settings ===
MagicNum=333007 MagicNum=333007
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -43,3 +43,7 @@ InpMaxDailyDrawdown=2.5
; === EA Settings === ; === EA Settings ===
MagicNum=333005 MagicNum=333005
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -48,3 +48,7 @@ InpMaxDailyDrawdown=3.0 ; Standard for major pair
; === EA Settings === ; === EA Settings ===
MagicNum=333011 MagicNum=333011
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -52,3 +52,7 @@ InpMaxDailyDrawdown=1.5 ; VERY conservative
; === EA Settings === ; === EA Settings ===
MagicNum=333014 MagicNum=333014
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -50,3 +50,7 @@ InpMaxDailyDrawdown=2.0 ; Conservative (volatile)
; === EA Settings === ; === EA Settings ===
MagicNum=333013 MagicNum=333013
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -43,3 +43,7 @@ InpMaxDailyDrawdown=3.0
; === EA Settings === ; === EA Settings ===
MagicNum=333003 MagicNum=333003
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -47,3 +47,7 @@ InpMaxDailyDrawdown=2.5
; === EA Settings === ; === EA Settings ===
MagicNum=333008 MagicNum=333008
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -43,3 +43,7 @@ InpMaxDailyDrawdown=2.0 ; Conservative daily limit
; === EA Settings === ; === EA Settings ===
MagicNum=333001 MagicNum=333001
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -47,3 +47,7 @@ InpMaxDailyDrawdown=2.5
; === EA Settings === ; === EA Settings ===
MagicNum=333006 MagicNum=333006
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -48,3 +48,7 @@ InpMaxDailyDrawdown=2.0 ; Conservative (SNB risk)
; === EA Settings === ; === EA Settings ===
MagicNum=333009 MagicNum=333009
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -49,3 +49,7 @@ InpMaxDailyDrawdown=2.5 ; Conservative (trending pair)
; === EA Settings === ; === EA Settings ===
MagicNum=333012 MagicNum=333012
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -43,3 +43,7 @@ InpMaxDailyDrawdown=2.0 ; Conservative limit for volatile pairs
; === EA Settings === ; === EA Settings ===
MagicNum=333002 MagicNum=333002
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -49,3 +49,7 @@ InpMaxDailyDrawdown=1.5 ; VERY conservative
; === EA Settings === ; === EA Settings ===
MagicNum=333010 MagicNum=333010
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=17

View File

@@ -0,0 +1,411 @@
{
"name": "MQL Trading Bots - Settings Validator",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"hoursInterval": 6
}
]
}
},
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.1,
"position": [
250,
300
]
},
{
"parameters": {
"command": "cd /home/garfield/mql-trading-bots && ls -la *.set 2>/dev/null | wc -l"
},
"name": "Count Set Files",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
450,
300
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "8ef4b80d-8c5a-4ea3-9a5a-b8be7355f4a7",
"leftValue": "={{ $json.stdout }}",
"rightValue": "0",
"operator": {
"type": "number",
"operation": "notEquals"
}
}
]
}
},
"name": "Files Exist?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
650,
300
]
},
{
"parameters": {
"command": "cd /home/garfield/mql-trading-bots && for f in confluence-*.set; do echo \"=== $f ===\"; grep -E 'InpMinStrength|InpMinConfluence|InpRequireAllAgree|InpDebugMode' \"$f\" | grep -v '^;'; done"
},
"name": "Check Confluence Sets",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
850,
200
]
},
{
"parameters": {
"command": "cd /home/garfield/mql-trading-bots && for f in grid-*.set; do echo \"=== $f ===\"; grep -E 'MaxLevels|InpMaxDailyDrawdown|InpCloseBeforeWeekend' \"$f\" | grep -v '^;'; done"
},
"name": "Check Grid Sets",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
850,
400
]
},
{
"parameters": {
"command": "cd /home/garfield/mql-trading-bots && grep -l 'InpMinConfluenceStrength' confluence-*.set 2>/dev/null || echo 'No invalid variables found'"
},
"name": "Check Invalid Variables",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
1050,
200
]
},
{
"parameters": {
"command": "cd /home/garfield/mql-trading-bots && grep 'InpDebugMode=false' confluence-*.set grid-*.set 2>/dev/null | wc -l"
},
"name": "Count Debug Off",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
1050,
400
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "e6b7c7d1-6d61-413f-90a4-5ce2e8b7dc2e",
"leftValue": "={{ $json.stdout }}",
"rightValue": "No invalid",
"operator": {
"type": "string",
"operation": "notContains"
}
}
]
}
},
"name": "Invalid Vars Found?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
1250,
200
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "b7c8d9e0-f1a2-4b3c-5d6e-7f8a9b0c1d2e",
"leftValue": "={{ $json.stdout }}",
"rightValue": "0",
"operator": {
"type": "number",
"operation": "notEquals"
}
}
]
}
},
"name": "Debug Disabled?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
1250,
400
]
},
{
"parameters": {
"options": {}
},
"name": "Merge Issues",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.1,
"position": [
1450,
300
]
},
{
"parameters": {
"to": "={{ $env.ALERT_EMAIL }}",
"subject": "🚨 MQL Settings Issues Detected",
"text": "=Issues found in MQL Trading Bots settings:
Invalid Variables Found:
{{ $('Check Invalid Variables').item.json.stdout }}
Files with Debug Disabled: {{ $('Count Debug Off').item.json.stdout }}
Confluence Settings:
{{ $('Check Confluence Sets').item.json.stdout }}
Grid Settings:
{{ $('Check Grid Sets').item.json.stdout }}
Please review and fix ASAP.
Server: {{ $env.HOSTNAME }}
Time: {{ $now }}"
},
"name": "Send Alert Email",
"type": "n8n-nodes-base.emailSend",
"typeVersion": 2.1,
"position": [
1650,
200
]
},
{
"parameters": {
"content": "={{$json}}",
"options": {}
},
"name": "No Action Needed",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1650,
500
]
},
{
"parameters": {
"command": "cd /home/garfield/mql-trading-bots && git diff --name-only HEAD~1 2>/dev/null | grep '\.set$' || echo 'No recent set file changes'"
},
"name": "Check Recent Changes",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
850,
600
]
},
{
"parameters": {
"webhookUri": "={{ $env.DISCORD_WEBHOOK_URL }}",
"text": "={ '🚨 **MQL Settings Alert**' if $json.stdout != 'No recent set file changes' and $json.stdout != '' else '✅ **MQL Settings Check** - All OK' }",
"options": {}
},
"name": "Discord Notification",
"type": "n8n-nodes-base.discord",
"typeVersion": 2,
"position": [
1250,
600
]
}
],
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [
{
"name": "trading",
"id": "trading-tag",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
},
{
"name": "mql5",
"id": "mql5-tag",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}
],
"connections": {
"Schedule Trigger": {
"main": [
[
{
"node": "Count Set Files",
"type": "main",
"index": 0
}
]
]
},
"Count Set Files": {
"main": [
[
{
"node": "Files Exist?",
"type": "main",
"index": 0
}
]
]
},
"Files Exist?": {
"main": [
[
{
"node": "Check Confluence Sets",
"type": "main",
"index": 0
},
{
"node": "Check Grid Sets",
"type": "main",
"index": 0
},
{
"node": "Check Recent Changes",
"type": "main",
"index": 0
}
],
[
{
"node": "No Action Needed",
"type": "main",
"index": 0
}
]
]
},
"Check Confluence Sets": {
"main": [
[
{
"node": "Check Invalid Variables",
"type": "main",
"index": 0
}
]
]
},
"Check Grid Sets": {
"main": [
[
{
"node": "Count Debug Off",
"type": "main",
"index": 0
}
]
]
},
"Check Invalid Variables": {
"main": [
[
{
"node": "Invalid Vars Found?",
"type": "main",
"index": 0
}
]
]
},
"Count Debug Off": {
"main": [
[
{
"node": "Debug Disabled?",
"type": "main",
"index": 0
}
]
]
},
"Invalid Vars Found?": {
"main": [
[
{
"node": "Merge Issues",
"type": "main",
"index": 0
}
]
]
},
"Debug Disabled?": {
"main": [
[
{
"node": "Merge Issues",
"type": "main",
"index": 0
}
]
]
},
"Merge Issues": {
"main": [
[
{
"node": "Send Alert Email",
"type": "main",
"index": 0
}
]
]
},
"Check Recent Changes": {
"main": [
[
{
"node": "Discord Notification",
"type": "main",
"index": 0
}
]
]
}
}
}

88
n8n-workflow-simple.json Normal file
View File

@@ -0,0 +1,88 @@
{
"name": "MQL Settings Monitor - Simple",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"hoursInterval": 6
}
]
}
},
"name": "Every 6 Hours",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.1,
"position": [250, 300]
},
{
"parameters": {
"command": "cd /home/garfield/mql-trading-bots && ./scripts/validate-settings.sh"
},
"name": "Run Validation Script",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [450, 300]
},
{
"parameters": {
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.stdout }}",
"operator": "contains",
"rightValue": "ISSUE"
}
]
}
},
"name": "Issues Found?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [650, 300]
},
{
"parameters": {
"chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
"text": "=🚨 MQL Settings Issues Found:\n\n{{ $json.stdout }}\n\n⏰ {{ $now.format('YYYY-MM-DD HH:mm') }}"
},
"name": "Send Telegram Alert",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.1,
"position": [850, 200]
},
{
"parameters": {
"content": "=✅ Settings check passed\n\n{{ $json.stdout }}",
"options": {}
},
"name": "Success - No Action",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [850, 400]
}
],
"connections": {
"Every 6 Hours": {
"main": [
[{ "node": "Run Validation Script", "type": "main", "index": 0 }]
]
},
"Run Validation Script": {
"main": [
[{ "node": "Issues Found?", "type": "main", "index": 0 }]
]
},
"Issues Found?": {
"main": [
[{ "node": "Send Telegram Alert", "type": "main", "index": 0 }],
[{ "node": "Success - No Action", "type": "main", "index": 0 }]
]
}
},
"settings": {
"executionOrder": "v1"
}
}

128
scripts/validate-settings.sh Executable file
View File

@@ -0,0 +1,128 @@
#!/bin/bash
# MQL Trading Bot Settings Validator
# This script validates .set files for common issues
REPO_DIR="/home/garfield/mql-trading-bots"
cd "$REPO_DIR" || exit 1
ISSUES=0
echo "=== MQL Settings Validation Report ==="
echo "Date: $(date)"
echo ""
# Check 1: Count set files
echo "[INFO] Checking set files..."
CONFLUENCE_COUNT=$(ls -1 confluence-*.set 2>/dev/null | wc -l)
GRID_COUNT=$(ls -1 grid-*.set 2>/dev/null | wc -l)
echo " Confluence settings: $CONFLUENCE_COUNT files"
echo " Grid settings: $GRID_COUNT files"
if [ $CONFLUENCE_COUNT -eq 0 ] && [ $GRID_COUNT -eq 0 ]; then
echo "ISSUE: No .set files found!"
ISSUES=$((ISSUES + 1))
fi
# Check 2: Invalid variable names (typos)
echo ""
echo "[INFO] Checking for invalid variable names..."
INVALID=$(grep -l "InpMinConfluenceStrength\|MinConfluenceStrength\|ConfluenceStrength" confluence-*.set 2>/dev/null)
if [ -n "$INVALID" ]; then
echo "ISSUE: Invalid variable names found:"
echo "$INVALID" | while read -r file; do
echo " - $file"
done
ISSUES=$((ISSUES + 1))
else
echo " ✓ No invalid variable names found"
fi
# Check 3: Missing critical parameters in Confluence sets
echo ""
echo "[INFO] Checking Confluence settings completeness..."
for file in confluence-*.set; do
[ -f "$file" ] || continue
MISSING=""
grep -q "^InpMinConfluence=" "$file" || MISSING="$MISSING InpMinConfluence"
grep -q "^InpMinStrength=" "$file" || MISSING="$MISSING InpMinStrength"
grep -q "^InpRequireAllAgree=" "$file" || MISSING="$MISSING InpRequireAllAgree"
grep -q "^InpMagicNumber=" "$file" || MISSING="$MISSING InpMagicNumber"
grep -q "^InpMaxDailyDrawdown=" "$file" || MISSING="$MISSING InpMaxDailyDrawdown"
grep -q "^InpCloseBeforeWeekend=" "$file" || MISSING="$MISSING InpCloseBeforeWeekend"
if [ -n "$MISSING" ]; then
echo "ISSUE: $file missing:$MISSING"
ISSUES=$((ISSUES + 1))
fi
done
# Check 4: Missing critical parameters in Grid sets
echo ""
echo "[INFO] Checking Grid settings completeness..."
for file in grid-*.set; do
[ -f "$file" ] || continue
MISSING=""
grep -q "^InpMaxDailyDrawdown=" "$file" || MISSING="$MISSING InpMaxDailyDrawdown"
grep -q "^InpCloseBeforeWeekend=" "$file" || MISSING="$MISSING InpCloseBeforeWeekend"
if [ -n "$MISSING" ]; then
echo "ISSUE: $file missing:$MISSING"
ISSUES=$((ISSUES + 1))
fi
done
# Check 5: Very restrictive settings (may explain no trades)
echo ""
echo "[INFO] Checking for overly restrictive settings..."
HIGH_STRENGTH=$(grep "InpMinStrength=0.8" confluence-*.set 2>/dev/null | cut -d: -f1)
if [ -n "$HIGH_STRENGTH" ]; then
echo "WARNING: High strength thresholds (may block trades):"
echo "$HIGH_STRENGTH" | while read -r file; do
strength=$(grep "InpMinStrength=" "$file" | head -1)
echo " - $file: $strength"
done
fi
# Check 6: Debug mode status
echo ""
echo "[INFO] Debug mode status..."
DEBUG_OFF=$(grep "InpDebugMode=false" confluence-*.set grid-*.set 2>/dev/null | wc -l)
DEBUG_ON=$(grep "InpDebugMode=true" confluence-*.set grid-*.set 2>/dev/null | wc -l)
echo " Debug ON: $DEBUG_ON files"
echo " Debug OFF: $DEBUG_OFF files"
if [ $DEBUG_OFF -gt 5 ]; then
echo "WARNING: Many files have debug disabled - you won't see trade decisions"
fi
# Check 7: Weekend protection status
echo ""
echo "[INFO] Weekend protection status..."
WEEKEND_OFF=$(grep "InpCloseBeforeWeekend=false" confluence-*.set grid-*.set 2>/dev/null | wc -l)
if [ $WEEKEND_OFF -gt 0 ]; then
echo "WARNING: $WEEKEND_OFF files have weekend protection DISABLED"
ISSUES=$((ISSUES + 1))
else
echo " ✓ All files have weekend protection enabled"
fi
# Check 8: Git status
echo ""
echo "[INFO] Checking git status..."
UNTRACKED=$(git ls-files --others --exclude-standard *.set 2>/dev/null | wc -l)
if [ $UNTRACKED -gt 0 ]; then
echo "WARNING: $UNTRACKED untracked .set files:"
git ls-files --others --exclude-standard *.set 2>/dev/null | head -5
fi
# Summary
echo ""
echo "=== Summary ==="
if [ $ISSUES -eq 0 ]; then
echo "✅ All checks passed!"
else
echo "❌ Found $ISSUES issue(s)"
fi
exit $ISSUES