# 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