# Session Save Point - 2026-03-22 **Created:** $(date '+%Y-%m-%d %H:%M:%S %Z') **Status:** Complete - Ready for system restart --- ## Current Project State ### MultiSignal Confluence EA v1.12 **Status:** Fully implemented and committed **Location:** - Git: https://git.fetcherpay.com/garfield/mql-trading-bots - Commit: `e2d42b3` - "Add complete volatility filters v1.12 (Anti-Chop)" - Local: `~/mql-trading-bots/MultiSignal_Confluence_EA.mq5` - MT5: `~/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Experts/MultiSignal_Confluence_EA.mq5` **Features Added in v1.12:** - ATR Volatility Filter (0.5% minimum) - ADX Trend Strength Filter (20 minimum) - CheckVolatilityFilter() function called before every trade - Both filters ON by default, configurable via inputs **Trading Performance (Verified):** - Account: 104125640 - Started: $100,000 - Current: $106,935.12 (+6.94%) - Trades: 78 - Win Rate: 71.79% - Profit Factor: 1.29 - Largest Win: $2,216 - Largest Loss: -$1,303 --- ## Active Trading Setup ### MT5 Docker Container - Container: `mt5` (gmag11/metatrader5_vnc:1.1) - VNC Access: Port 3000 - Config Volume: `/home/garfield/mt5-docker/config` ### Account Details - Login: 104125640 - Server: MetaQuotes-Demo - Platform: MetaTrader 5 ### Report Access - Direct HTML: `file:///home/garfield/mt5-docker/config/.wine/drive_c/users/abc/Desktop/ReportHistory-104125640.html` - Utility Scripts: `show-latest-report.sh`, `read-report.sh`, `export-to-browser.sh` --- ## Repositories ### mql-trading-bots - URL: https://git.fetcherpay.com/garfield/mql-trading-bots - Credentials: garfield@fetcherpay.com / onelove01 - Main File: `MultiSignal_Confluence_EA.mq5` ### conversation-history - URL: https://git.fetcherpay.com/garfield/conversation-history - Session Log: `2026-03-21-mql-trading-bots.md` - This Save: `SESSION_SAVE_2026-03-22.md` --- ## What's Next (Post-Restart) 1. **Verify MT5 Compilation** - Check Journal for successful v1.12 compile 2. **Monitor New Trades** - Watch for "Volatility filter BLOCKED" messages 3. **Compare Performance** - Expect fewer trades but higher quality 4. **Backtest** - Run strategy tester on v1.12 vs v1.11 --- ## Key Code References ### Volatility Filter (lines 200-223) ```cpp bool CheckVolatilityFilter() { if(InpUseVolatilityFilter && ATRHandle != INVALID_HANDLE) { double atr[1], close = iClose(_Symbol, _Period, 0); if(CopyBuffer(ATRHandle, 0, 0, 1, atr) > 0) { double atrPct = (atr[0] / close) * 100; if(atrPct < InpMinATRPercent) { Print("Volatility filter BLOCKED: ATR too low"); return false; } } } // ... ADX filter ... return true; } ``` ### Trade Entry Call (line 616) ```cpp if(!CheckVolatilityFilter()) return; // Skip trade - filters not passed ``` --- ## Notes for Future Self - All work saved to Gitea - accessible from any machine - MT5 data persists in Docker volume - v1.12 designed to reduce choppy market losses - If filters are too aggressive, adjust: `InpMinATRPercent` or `InpMinADX` **Session End - Safe to restart** --- ## Ollama Upgrade Script Created **File:** `~/upgrade-ollama.sh` The automated upgrade via tool commands was timing out on sudo operations, so an upgrade script was created for manual execution. ### To Upgrade Ollama: ```bash ~/upgrade-ollama.sh ``` This will: 1. Stop the current ollama service 2. Backup existing binary 3. Download latest version (currently v0.18.2) 4. Install and start the new version 5. Verify it's working ### Current Status: - Running: v0.12.11 - Available: v0.18.2 - Location: /usr/local/bin/ollama - Service: systemd (ollama.service) - API: localhost:11434 --- ## OrdersEA Found and Committed **Date:** March 24, 2026 ### Files Located - `~/mql/OrdersEA (1).mq4` - Original MT4 version (v1.1) - `~/mql/OrdersEA.mq5` - MT5 version ### Committed to Repository - Commit: `9fac45a` - Files: `OrdersEA (1).mq4`, `OrdersEA.mq5` - Location: `~/mql-trading-bots/` ### OrdersEA Strategy **Type:** Grid/Layering/Basket Trading EA **How it works:** 1. Defines a price range with `HIGH` and `LOW` parameters (central zone) 2. Places multiple small pending orders at intervals (`Entry` spacing) 3. Above HIGH: Layer of BUY STOP orders 4. Below LOW: Layer of SELL STOP orders 5. Manages basket of up to 600 trades 6. Calculates average price for exit 7. Equity-based lot sizing option **Key Parameters:** - `HIGH` / `LOW` - Central range boundaries - `Entry` - Spacing between trade levels - `Lots` - Size per trade - `TP` - Take profit per level - `TRADE_RANGE` - Trading range in pips - `MaxTrades` - Up to 600 **Risk Management:** - `EquityFactorPercent` - Dynamic lot sizing - `TakeProfitLevelDollarAmount` - Basket profit target - `GetOut` - Emergency exit flag **Status:** Ready for use on MT4 or MT5 --- ## OrdersEA Cleaned and Updated **Date:** March 24, 2026 ### Changes Made: 1. **Removed WinAPI dependency** - MT4: Removed `#include ` - MT5: Removed `#include "include\WinAPI\winuser.mqh"` - Replaced `MessageBox()` with `Print()` for margin info display 2. **Removed license checking** - Removed web.mq5/web.mq4 includes - Bypassed `IsOK()` license validation - Removed customer monitoring code 3. **Updated notifications** - MT4: `SendNotificationEx()` uses `Alert()` and `Print()` - MT5: `SendNotificationEx()` uses `SendNotification()` and `Print()` - Replaced all `SendMail()` calls with native alternatives 4. **Updated metadata** - Copyright: "Copyright 2024, Garfield Heron" - Website: "https://fetcherpay.com" - Default Email: "garfield@fetcherpay.com" ### Files Updated: - `OrdersEA.mq5` (MT5 version) - `OrdersEA (1).mq4` (MT4 version) ### Commits: - `bf70b79` - Clean up OrdersEA.mq5 - `c342966` - Clean up OrdersEA MT4 version --- ## Oanda MT4 Status & OrdersEA Conversion **Date:** March 24, 2026 ### Oanda Platform Status (Verified) - **MT4:** ✅ Fully supported globally (Oanda's primary platform) - **MT5:** ⚠️ Available only in select regions (Japan, UK, Europe, BVI) - **MT5 US:** ❌ NOT available for Oanda US clients - **Rating:** Oanda rated "Best MetaTrader 4 Broker 2026" ### MT4 Environment Setup - Attempted Docker MT4 setup - image not publicly available - Created MT4 directory in Wine prefix: `~/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 4/` - **Note:** MT4 installer must be downloaded from Oanda directly (MetaQuotes removed public downloads) ### OrdersEA Conversion to MT5 **Files Created:** - `OrdersEA.mq5` - Converted MT5 version (v2.0) - `OrdersEA_MT4_Original.mq5` - Original MT4 backup - `OrdersEA_MT5_Converted.mq5` - Conversion reference **Key Conversions Made:** | MT4 | MT5 | |-----|-----| | `OrderSelect()` | `PositionGet()` / `HistorySelect()` | | `MarketInfo()` | `SymbolInfoDouble/Integer()` | | `Bid`, `Ask`, `Digits`, `Point` | `SymbolInfoDouble(_Symbol, SYMBOL_BID/ASK/POINT)` | | `OrderSend()` | `CTrade::OrderSend()` | | `OrderClose()` | `CTrade::PositionClose()` | | `int ticket` | `ulong ticket` | | `WindowExpertName()` | `MQLInfoString(MQL_PROGRAM_NAME)` | | `IsOptimization()` | `MQLInfoInteger(MQL_OPTIMIZATION)` | **Commit:** `c415cd9` --- ## MT5 Freeze Analysis & Solutions **Date:** March 24, 2026 ### Why Did It Freeze? **Root Cause:** OrdersEA.mq5 was an **MT4 file disguised as MT5** | Issue | Details | |-------|---------| | File Type | MT4 syntax with .mq5 extension | | Syntax Errors | 100 errors detected by MetaEditor | | Problem Functions | OrderSelect(), MarketInfo(), Bid, Digits, Point | | Trigger | MetaEditor hung while processing errors | | Wine Factor | Windows apps in Wine are less stable with errors | ### What Happened: 1. MetaEditor tried to compile OrdersEA.mq5 2. Found 100 MT4-specific syntax errors 3. Got stuck in error processing loop 4. VNC session froze (MetaEditor was active window) 5. Required container restart to clear ### Solutions Implemented: **1. Syntax Checker** (`check-syntax.sh`) ```bash ./check-syntax.sh OrdersEA.mq5 # Detects MT4 functions before compilation ``` **2. Watchdog** (`metaeditor-watchdog.sh`) - Auto-kills MetaEditor if running >5 minutes - Kills if CPU >50% for extended period **3. Safe Compile** (`safe-compile.sh`) - 2-minute timeout on compilations - Auto-kills on timeout - Prevents indefinite hangs ### Prevention Tips: 1. Always check syntax before compiling unknown files 2. Use MT4→MT5 conversion tools for old code 3. Watch for MetaEditor freezes during compilation 4. Restart container if VNC becomes unresponsive --- ## OrdersEA Smart Grid v3.0 Created **Date:** March 24, 2026 ### New EA: OrdersEA_Smart_Grid.mq4 **Features:** 1. **Auto Pivot Calculation** - Calculates P, R1, S1, R2, S2 from daily data 2. **RSI Filter** - Only trades when RSI is in neutral zone (35-65) 3. **ADX Filter** - Only trades when ADX < 25 (ranging market) 4. **ATR Adaptive Range** - Grid range adjusts to volatility 5. **Max Levels** - Safety limit on grid depth 6. **Auto Recalculation** - Updates pivots at new trading day ### Key Parameters: **Grid Settings:** - UseAutoPivots: true = auto-calculate, false = use manual HIGH/LOW - Entry: Grid spacing in pips (default 10) - TP: Take profit per level (default 15) - MaxLevels: Maximum orders per side (default 10) **Filters:** - UseRSIFilter: Enable RSI check - RSILower/RSIUpper: 35/65 default (neutral zone) - UseADXFilter: Enable trend detection - ADXMax: 25 default (below = ranging) - UseATRFilter: Enable volatility-based range - ATRMultiplier: 1.5 default (range = ATR × 1.5) ### How It Works: 1. At startup, calculates yesterday's pivot points 2. Sets grid range: HIGH = R1 (or R2), LOW = S1 (or S2) 3. Each tick checks: - RSI between 35-65? (Not overbought/oversold) - ADX < 25? (Not trending) - Price within range? 4. If all pass, places grid orders 5. If market trends (ADX > 25), stops placing new orders ### Commit: 73d420c --- ## OrdersEA_Smart_Grid - Full MT5 Conversion **Date:** March 24, 2026 ### MT5 Conversion Complete **File:** `OrdersEA_Smart_Grid.mq5` (480 lines) **Commit:** `f0b8653` ### Conversion Changes (MQL4 → MQL5): | MQL4 (MT4) | MQL5 (MT5) | |------------|------------| | `OrderSend()` | `CTrade::OrderSend()` | | `OrderSelect()` | `PositionSelect()` / `HistorySelect()` | | `MarketInfo()` | `SymbolInfoDouble/Integer()` | | `Bid`, `Ask` | `SymbolInfoDouble(_Symbol, SYMBOL_BID/ASK)` | | `Digits` | `_Digits` | | `Point` | `SymbolInfoDouble(_Symbol, SYMBOL_POINT)` | | `int ticket` | `ulong ticket` | | `iRSI(,,,)` | `iRSI()` handle + `CopyBuffer()` | | `OP_BUYSTOP` | `ORDER_TYPE_BUY_STOP` | | `OP_SELLSTOP` | `ORDER_TYPE_SELL_STOP` | | `OrderFillOrKill` | `ORDER_FILLING_IOC` | | `TimeHour()` | `MqlDateTime` struct | ### Key Features: - ✅ Auto-calculates daily pivot points - ✅ RSI filter (35-65 neutral zone) - ✅ ADX filter (<25 = ranging) - ✅ ATR-based adaptive range - ✅ MT5 compliant order placement - ✅ Proper error handling ### Ready for Testing! --- ## ✅ OrdersEA_Smart_Grid.mq5 - COMPILE SUCCESS! **Date:** March 24, 2026 ### All Errors Fixed: 1. ✅ Array declarations (fixed-size arrays for CopyBuffer) 2. ✅ Type conversions (initEquity int → double) 3. ✅ Missing input declarations (EquityFactorPercent, LotsFactorPercent) 4. ✅ WinAPI includes removed 5. ✅ MT5 syntax compliance ### Final Commit: 2bdaee0 ### Status: READY FOR TESTING! The EA is now compiled and ready to use in MT5 with: - Auto pivot point calculation - RSI filter (35-65 range) - ADX filter (<25 = ranging) - ATR-based adaptive grid - Full MT5 order management --- ## 24 Hour OrdersEA Performance Analysis **Date:** March 25, 2026 ### Performance Summary - **Total Trades:** ~135 unique deals - **GBPUSD:** 253 orders (most active pair) - **EURUSD:** 113 orders - **USDJPY:** 4 orders (filtered by ADX) - **Trade Balance:** 179 SELL / 179 BUY (well balanced) ### Key Findings 1. **GBPUSD performed best** - high activity, good fills 2. **Filters working** - USDJPY correctly blocked when ADX=46.7 3. **Order management** - cancellations working at 07:00 4. **No orphan orders** - cleanup functioning ### Lot Size Recommendations | Pair | Current | Recommended | Reason | |------|---------|-------------|--------| | GBPUSD | 0.01 | 0.01 or 0.005 | High volatility | | EURUSD | 0.01 | 0.02-0.03 | Stable ranging | | USDJPY | 0.01 | 0.02 | Tight ranges | | EURJPY | 0.01 | 0.005 or avoid | Very high risk | ### Max Levels Adjustment - GBPUSD: 10 → 6-8 levels - EURUSD: 10 → 8-10 levels - USDJPY: 10 → 10-12 levels - EURJPY: 10 → 5-6 levels ### Grid Spacing Adjustment - GBPUSD: Entry 15 → 20 pips, TP 25 → 30 pips - EURUSD: Keep current settings - USDJPY: Entry 8 → 5 pips, TP 12 → 8 pips ### Account Size Guidelines - **$10,000:** 0.01 lots (current) - Conservative - **$25,000:** 0.02-0.03 lots - Moderate - **$50,000+:** 0.05 lots - Aggressive **Overall Rating: 7/10** - Working well, needs lot optimization --- ## MultiSignal Confluence EA v1.13 - Dynamic Lot Sizing **Date:** March 25, 2026 ### New Features - **InpUseRiskPercent**: Enable risk-based dynamic lot sizing - **InpRiskPercent**: Set risk % per trade (1%, 2%, 5%, etc.) - **CalculateLotSize()**: Automatically calculates lots based on: - Account balance - Risk percentage - Stop loss distance - Symbol tick value/size ### Formula ``` Lot Size = Risk$ / (SL_Points × TickValue/TickSize) ``` ### Recommended Settings | Account Size | Risk% | Expected Lot | |--------------|-------|--------------| | $10,000 | 1.0% | 0.01-0.02 | | $25,000 | 2.0% | 0.03-0.04 | | $50,000 | 3.0% | 0.08-0.10 | | $100,000+ | 5.0% | 0.20-0.30 | ### Additional Optimizations - **Max Positions**: Can increase from 3 to 5 for more trades - **SL/TP**: 100/200 points maintains 1:2 risk/reward - **Confluence**: Keep at 2 signals minimum for quality ### Commit 2f8c24a - MultiSignal Confluence EA v1.13 --- ## MultiSignal Confluence EA Settings Check **Date:** March 25, 2026 ### Current Default Settings (v1.13) | Setting | Value | Notes | |---------|-------|-------| | Min Confluence | 2 | 2-3 signals required | | Min Strength | 0.90 | 90% confidence | | Require All Agree | TRUE | No conflicting signals | | Use Risk % | TRUE | Dynamic lot sizing ON | | Risk % | 1.0% | 1% per trade | | Stop Loss | 100 pts | 10 pips | | Take Profit | 200 pts | 20 pips | | Max Positions | 3 | Per symbol | | Trend Filter | FALSE | Disabled for more trades | | Volatility Filter | TRUE | Anti-chop ON | | ADX Filter | TRUE | Trend strength ON | | Min ADX | 20.0 | Minimum trend strength | ### Recommended Optimizations **For More Trades:** - Min Strength: 0.85 (lower) - Max Positions: 5 (increase) - Use ADX Filter: FALSE (disable) **For Higher Quality:** - Min Confluence: 3 (increase) - Min Strength: 0.95 (increase) - Use Trend Filter: TRUE (enable) - Min ADX: 25 (increase) **For Current Market (Balanced):** - Max Positions: 5 - Risk %: 2.0% (double position size) - Keep all other settings ### Issue Found Old test settings file exists from Feb 25 with different values. Users should verify current chart settings match intended configuration.