Files
garfield 0894d18db4 WIP: 6+ weeks of uncommitted EA development and preset tuning
Confluence EA (v1.16 → v1.20):
- Per-EA realized P&L tracking via history deals
- Weekly drawdown protection
- Warmup bars, pivot cache, state persistence
- Point-scaled pivot thresholds, ranging ATR factor
- Market filling mode helper per symbol

Grid EA (v3.1 → v4.1):
- Adaptive filters, adaptive entry, spread filter
- Session filter, breakeven, correlation caps, range drift
- Profit protection (stop-after-profit, cycle reports)
- Edge cleanup v5.0 — close wrong-side positions outside grid
- Master one-shot shutdown, grid state persistence

Presets:
- Fix GetOut=Y shutdown bug on 4 grid presets
- Relax ADXMax 18→40, widen RSI 20/80 across grid presets
- Standardize daily drawdown 3%→5%, add weekly 10%
- Increase grid lots 0.01→0.03
- Normalize confluence ATR thresholds per pair
- Add XAGUSD, EURCHF, EURGBP, AUDNZD presets

Docs & DevOps:
- April 23 audit files (preset mismatch, code review, checklist)
- n8n workflow and validation infrastructure updates
- AI agent analyses in notes/

Known issues carried forward:
- Shared drawdown budget contamination (both EAs)
- Confluence ranging-market threshold inversion
- Older grid presets missing v4.1 safety controls
2026-05-12 09:02:25 -04:00

3.0 KiB
Executable File

N8N SSH Setup - Run validate-settings.sh

Overview

Use n8n's SSH node to run the validation script on localhost.

Prerequisites

SSH is running on localhost (confirmed) User garfield exists

Setup Steps

# Generate SSH key (no passphrase for automation)
ssh-keygen -t ed25519 -f ~/.ssh/n8n_key -N ""

# Copy public key to authorized_keys
cat ~/.ssh/n8n_key.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

# Test connection
ssh -i ~/.ssh/n8n_key garfield@localhost "echo 'SSH works!'"

2. Import Workflow

  1. Open n8n: http://localhost:5678
  2. Click "Add Workflow"
  3. Click "Import from File"
  4. Select: n8n-workflow-ssh-local.json

3. Configure SSH Credentials

In n8n:

  1. Click the "SSH - Run Validation" node
  2. Click "Create New Credential"
  3. Choose "SSH Password" (or SSH Private Key if you created one)
  4. Enter:
    • Host: localhost
    • Port: 22
    • User: garfield
    • Password: Your user password (or path to private key)

4. Configure Telegram (Optional)

  1. Get bot token from @BotFather
  2. Get chat ID from @userinfobot
  3. Add Telegram credentials in n8n

5. Activate

  1. Toggle "Active" in top-right
  2. Click "Save"

Testing

Manual Trigger

Click "Execute Workflow" to test immediately.

Check Output

The SSH node will return:

  • stdout: Script output
  • code: Exit code (0 = success, >0 = issues found)

Alternative: Simple HTTP Endpoint

If SSH doesn't work, create a simple HTTP endpoint:

1. Create API Script

sudo tee /usr/local/bin/mql-validate-api.sh << 'EOF'
#!/bin/bash
echo "Content-Type: application/json"
echo ""
cd /home/garfield/mql-trading-bots
OUTPUT=$(./scripts/validate-settings.sh 2>&1)
CODE=$?

if [ $CODE -eq 0 ]; then
    echo '{"status":"ok","message":"All checks passed"}'
else
    echo "{\"status\":\"error\",\"code\":$CODE,\"message\":\"Issues found\",\"stdout\":\"$OUTPUT\"}"
fi
EOF
sudo chmod +x /usr/local/bin/mql-validate-api.sh

2. Setup Python HTTP Server

cd /home/garfield/mql-trading-bots
python3 -m http.server 8080 &

3. Use HTTP Request Node

Import: n8n-workflow-http.json

Troubleshooting

"Connection refused" error

# Check SSH is listening
sudo systemctl status sshd

# Check port
netstat -tlnp | grep 22

"Permission denied" error

# Check file permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Script not found

# Verify path
ls -la /home/garfield/mql-trading-bots/scripts/validate-settings.sh

Security Notes

  • Use SSH keys instead of passwords when possible
  • Restrict n8n key to only run validation script in ~/.ssh/authorized_keys:
    command="/home/garfield/mql-trading-bots/scripts/validate-settings.sh",no-pty,no-port-forwarding ssh-ed25519 AAAAC3... n8n@local
    
  • Keep n8n behind firewall/VPN

Manual Test

Test the script manually:

/home/garfield/mql-trading-bots/scripts/validate-settings.sh
echo "Exit code: $?"