Compare commits

...

2 Commits

Author SHA1 Message Date
87d2ea28bc deerflow 4/2 convo 2026-04-03 05:55:25 -04:00
1e3bf18662 Add session notes: 2026-04-01 MT5 analysis and EA fixes 2026-04-01 16:58:21 -04:00
3 changed files with 334 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
# Session: 2026-04-01 - MT5 Trading Analysis & EA Fixes
## Participants
- **User**: Garfield (garfield@fetcherpay.com)
- **AI**: opencode
## Session Overview
Analyzed MT5 trading logs, identified critical bugs and misconfigurations, and applied fixes to both the Confluence EA and the Grid EA.
---
## 1. Trading Activity Summary
- **Account**: 104125640 — MetaQuotes-Demo, Hedging
- **March P&L**: ~+$541,735.64 (1,199 deals) — heavy demo activity
- **Apr 1 Activity**: 106 deals (much quieter than Mar 31)
- **Current Open Positions**: 45 positions
- **Primary EAs**: `MultiSignal_Confluence_EA v1.18` + `OrdersEA_Smart_Grid v3.2`
### Confluence EA Status
- **Effectively dormant** over the last 2 days.
- Blocked by: low signal strength (23x) and ATR/volatility filters (7x).
- Filters are working as designed — avoiding choppy markets.
### Grid EA Status
- Active on NZDUSD, GBPJPY, USDCAD, GBPUSD.
- Identified a critical **order clustering bug** causing multiple stop orders to stack within 1 pip.
---
## 2. Critical Fixes Applied
### A. Grid Clustering Bug — FIXED & RECOMPILED
**File**: `~/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Experts/OrdersEA_Smart_Grid.mq5`
**Problem**: When a calculated grid level was too close to current price, the EA clamped it to the minimum allowed distance. This caused multiple buy/sell stops to pile up at the same price.
**Fix**: Changed `PlaceBuyStop()` and `PlaceSellStop()` to **skip (`return false`)** levels that are too close, rather than clamping them.
**Status**: ✅ Recompiled successfully (`.ex5` updated).
### B. Desktop `.set` Files — FIXED
**Files**: `~/Desktop/confluence*.set`
**Problem**: These files used old parameter names from a previous EA version (`InpMinConfluenceStrength`, `InpMaxSignalAge`, `InpUseATRFilter`, `InpAvoidWeekends`, etc.). MT5 silently ignored them, so charts were running on defaults.
**Fix**: Rewrote all Desktop confluence `.set` files with correct `v1.18` parameter names, then synced them with the optimized `MQL5/Presets/` versions.
### C. Unique Magic Numbers — ENSURED
- **Confluence presets**: Each pair now has a unique magic number (e.g., `777772` for EURUSD, `777780` for GBPJPY). `confluence-audusd.set` was kept at `777777` to avoid orphaning live trades.
- **Grid presets**: Already unique (`333001``333014`). Desktop grid `.set` files were synced to match.
### D. New Feature: `InpStopAfterProfit` — ADDED
**File**: `OrdersEA_Smart_Grid.mq5`
**What it does**: When enabled (`InpStopAfterProfit=true`), the Grid EA stops placing new grids for the rest of the day after a **profitable cycle** (all positions close with equity higher than the cycle start).
**Reset**: Automatically clears at broker time hour `00:00`.
**Parameter added** to all grid `.set` files (default `false`).
---
## 3. Files Modified
### Source Code
- `~/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Experts/OrdersEA_Smart_Grid.mq5`
- `~/mt5-docker/source-files/OrdersEA_Smart_Grid.mq5`
### Compiled Binary
- `~/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Experts/OrdersEA_Smart_Grid.ex5`
### Presets (MQL5 & Desktop)
- All `confluence-*.set` files (parameter names + magic numbers)
- All `grid-*.set` files (magic numbers + `InpStopAfterProfit`)
### Infrastructure
- `~/devops/INFRASTRUCTURE.md` — Added `doc.fetcherpay.com` and `www.fetcherpay.com` to DNS whitelist
- `~/fetcherpay-docs/k8s/docs-deployment.yaml` — Added `doc.fetcherpay.com` to ingress
- `~/fetcherpay-k8s/fetcherpay-complete.yaml` — Fixed truncated ingress section
---
## 4. Action Items for User
1. **Reload `.set` files** on all MT5 charts (Properties → Load → select preset).
2. **Remove and re-attach** `OrdersEA_Smart_Grid` to pick up the recompiled binary with fixes.
3. **Restart MT5** after reloading to ensure clean state.
4. Optionally enable `InpStopAfterProfit=true` on grid charts if you want one profitable cycle per day.
## Session Status: ✅ COMPLETE

View File

@@ -0,0 +1,93 @@
# Session: 2026-04-03 - Confluence EA Crisis Analysis & Recovery Plan
## Participants
- **User**: Garfield (garfield@fetcherpay.com)
- **AI**: Jacob (Algorithmic Trading Partner)
## Session Overview
Critical analysis of MultiSignal Confluence EA v1.14 trading halt due to catastrophic account losses. Identified OrdersEA Smart Grid as primary cause of ~$60,000 loss. Created comprehensive diagnostic and recovery plan.
---
## Session Summary
**Objective:** Diagnose why MultiSignal Confluence EA v1.14 stopped trading for 2 weeks
**Key Findings:**
- **Root Cause:** Account equity at 47% (53% drawdown) triggering daily drawdown protection
- **Major Loss Source:** OrdersEA Smart Grid v3.0/v3.1 caused ~$60,000 loss through high-frequency trading (253 orders on GBPUSD in 24hrs)
- **Confluence EA Status:** Working correctly but had one bad trade due to ranging market fake signal
- **Current State:** EA correctly blocked from trading due to risk management protocols
## Account Timeline
- **March 22, 2026:** $106,935.12 balance (+6.94% profit, 71.79% win rate)
- **March 24-25:** OrdersEA Smart Grid added alongside Confluence EA
- **April 2, 2026:** Account equity dropped to 47% (~$60,000 loss)
## Technical Analysis
### Confluence EA v1.14 Features:
- ATR volatility filter
- ADX trend filter
- Dynamic risk management (1-5% per trade)
- 3% daily drawdown limit
- Fixed short signal detection bug (removed restrictive belowPivot check)
### Issue: Ranging Market Fake Signal
- EA got caught in whipsaw during ranging market conditions
- This is normal market behavior, not EA malfunction
- Risk management correctly prevented further losses
## Current Status
- **Daily drawdown protection active** - blocking all new trades
- **Equity at 47%** - below typical minimum thresholds
- **EA functioning correctly** - protective behavior, not malfunction
- **Monitoring plan:** Watch for resume next week when daily limits reset
## Next Steps
### Week of April 7-11, 2026:
1. **Monday-Tuesday:** Monitor for trading resume
2. **Wednesday:** If no trades, begin diagnostic process
3. **Use diagnostic checklist** for systematic troubleshooting
### Potential Issues to Check:
1. **Equity protection too strict** (may need >50% to trade)
2. **Daily drawdown memory persistence** (may need EA restart)
3. **Filters too conservative** (ATR/ADX thresholds too high)
4. **Market conditions unsuitable** (continued ranging)
## Risk Management Assessment
- **Daily drawdown protection: WORKING CORRECTLY**
- **Equity protection: WORKING CORRECTLY**
- **Signal quality filters: WORKING CORRECTLY**
- **Position sizing: APPROPRIATE**
## Recommendations
### Short-term:
- **Do NOT modify EA settings yet** - let protection systems work
- **Monitor market conditions** - avoid forcing trades in ranging markets
- **Wait for equity recovery** or account funding to restore trading capacity
### Long-term Enhancements:
- **Add breakout confirmation** - require 2-3 candles in direction
- **Strengthen ranging market detection** - avoid trades when ADX < 25
- **Time-of-day filters** - avoid low-liquidity periods
- **Volume confirmation** - require above-average volume for breakouts
## Files Generated:
1. `confluence_ea_diagnostic.md` - Systematic troubleshooting guide
2. `transfer_diagnostic.sh` - Script to transfer diagnostic to server
3. `2026-04-03-confluence-ea-analysis.md` - This session summary
## Infrastructure
- **Server:** 23.120.207.35 (Ubuntu)
- **MT5 Account:** 104125640 (MetaQuotes-Demo)
- **Docker:** gmag11/metatrader5_vnc:1.1
- **VNC Access:** Port 3000
- **Git Repository:** https://git.fetcherpay.com/garfield/conversation-history.git
---
**Session Conclusion:** The Confluence EA is working as designed. The lack of trading is due to proper risk management protecting the account after the Grid EA caused massive losses. Monitor next week for natural resume of trading activity.

150
confluence_ea_diagnostic.md Normal file
View File

@@ -0,0 +1,150 @@
# Confluence EA Diagnostic Checklist
**Date:** 2026-04-03
**Issue:** EA not trading despite being functional
## 🔍 Step-by-Step Diagnosis
### 1. Equity Protection Check
```bash
# Check current account state
Account Equity: _____%
Required Minimum: ____% (check EA settings)
Daily Drawdown Used: ____% of 3%
```
**Action:** If equity below threshold, either:
- Wait for account recovery
- Temporarily lower minimum equity setting
- Fund account to restore equity percentage
### 2. EA Settings Verification
```bash
# In MT5 Expert Properties
✓ Allow live trading: [Yes/No]
✓ Allow DLL imports: [Yes/No]
✓ Allow import of external experts: [Yes/No]
✓ Confirm live trading: [Yes/No]
# EA-Specific Settings
✓ InpUseRiskPercent: [True/False]
✓ InpRiskPercent: [1.0-5.0]%
✓ InpMaxPositions: [3-5]
✓ InpMinConfluence: [2-3]
✓ InpMinStrength: [0.85-0.95]
```
### 3. Filter Status Check
Monitor Journal for these filter blocks:
**Volatility Filter:**
- Message: "Volatility filter BLOCKED: ATR too low"
- Solution: Lower InpMinATRPercent or disable temporarily
**ADX Filter:**
- Message: "ADX filter BLOCKED: trend too weak/strong"
- Solution: Adjust InpMinADX or disable temporarily
**Confluence Filter:**
- Message: "Insufficient confluence signals"
- Solution: Lower InpMinConfluence from 3 to 2
**Strength Filter:**
- Message: "Signal strength below threshold"
- Solution: Lower InpMinStrength from 0.90 to 0.85
### 4. Market Condition Analysis
```bash
Current Market State:
EURUSD ATR: _____
GBPUSD ATR: _____
USDJPY ATR: _____
ADX Levels:
EURUSD ADX: _____
GBPUSD ADX: _____
USDJPY ADX: _____
```
**Normal Ranges:**
- ATR: 0.0050-0.0150 (50-150 pips daily range)
- ADX: 20-40 (trending but not extreme)
### 5. Symbol-Specific Issues
Check each trading pair individually:
**EURUSD (Chart 1):**
- EA loaded: [Yes/No]
- Last signal time: _____
- Filter blocks: _____
**GBPUSD (Chart 2):**
- EA loaded: [Yes/No]
- Last signal time: _____
- Filter blocks: _____
**Continue for all 10 pairs...**
### 6. Technical Fixes
**If filters too restrictive:**
```cpp
// Temporarily relax settings
InpMinATRPercent = 0.3 // Lower from 0.5
InpMinADX = 15 // Lower from 20
InpMinStrength = 0.80 // Lower from 0.90
InpMinConfluence = 2 // Lower from 3
```
**If equity protection too strict:**
```cpp
// Check for equity threshold settings
// May need to temporarily disable equity checks
// Or add manual override for recovery period
```
**If no signals generated:**
```cpp
// Enable debug mode in EA
// Add Print() statements in signal detection
// Monitor Journal for signal attempts
```
## 🎯 Expected Outcomes
### Normal Resume (Best Case):
- Monday: Daily limits reset
- Tuesday: First trades appear
- Wednesday: Regular trading rhythm restored
### Gradual Resume (Likely Case):
- Monday-Tuesday: Filters blocking due to low volatility
- Wednesday-Thursday: First trades as markets normalize
- Following week: Full trading restored
### Manual Intervention Needed (Worst Case):
- EA settings too conservative for current equity level
- Market conditions outside normal parameters
- Code modification required for recovery scenario
## 📞 Escalation Triggers
**Call for help if:**
1. No trades by Thursday with good market conditions
2. Journal shows unknown error messages
3. EA repeatedly starts then stops
4. Filters appear to be malfunctioning
5. Account equity continues declining despite no trading
## 📝 Documentation Requirements
**Daily Log Template:**
```
Date: _____
Equity: _____%
Trades Today: _____
Blocked Signals: _____
Filter Status: _____
Next Action: _____
```
This systematic approach will quickly identify if it's a temporary market/filter issue or a deeper problem requiring code changes.