From fe4fe656be61bc7da00edba89587ba4bf0d21ad4 Mon Sep 17 00:00:00 2001 From: Garfield Date: Fri, 3 Apr 2026 16:57:52 -0400 Subject: [PATCH] Update conversation history and add recent notes --- .gitignore | 0 .idea/.gitignore | 0 .idea/conversation-history.iml | 0 .idea/misc.xml | 0 .idea/modules.xml | 0 .idea/vcs.xml | 0 2026-03-21-mql-trading-bots.md | 0 2026-03-21-mql-trading-report-analysis.md | 0 2026-03-30-dns-whitelist.md | 16 +++ 2026-03-30-weekend-gap-short-signal-fix.md | 138 +++++++++++++++++++++ 2026-03-31-confluence-settings-update.md | 55 ++++++++ INFRASTRUCTURE.md | 87 +++++++++++++ README.md | 70 ++++++++--- REPOSITORIES.md | 0 SESSION_SAVE_2026-03-22.md | 0 TEMPLATE.md | 0 16 files changed, 349 insertions(+), 17 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .idea/.gitignore mode change 100644 => 100755 .idea/conversation-history.iml mode change 100644 => 100755 .idea/misc.xml mode change 100644 => 100755 .idea/modules.xml mode change 100644 => 100755 .idea/vcs.xml mode change 100644 => 100755 2026-03-21-mql-trading-bots.md mode change 100644 => 100755 2026-03-21-mql-trading-report-analysis.md create mode 100755 2026-03-30-dns-whitelist.md create mode 100755 2026-03-30-weekend-gap-short-signal-fix.md create mode 100755 2026-03-31-confluence-settings-update.md create mode 100755 INFRASTRUCTURE.md mode change 100644 => 100755 README.md mode change 100644 => 100755 REPOSITORIES.md mode change 100644 => 100755 SESSION_SAVE_2026-03-22.md mode change 100644 => 100755 TEMPLATE.md diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.idea/.gitignore b/.idea/.gitignore old mode 100644 new mode 100755 diff --git a/.idea/conversation-history.iml b/.idea/conversation-history.iml old mode 100644 new mode 100755 diff --git a/.idea/misc.xml b/.idea/misc.xml old mode 100644 new mode 100755 diff --git a/.idea/modules.xml b/.idea/modules.xml old mode 100644 new mode 100755 diff --git a/.idea/vcs.xml b/.idea/vcs.xml old mode 100644 new mode 100755 diff --git a/2026-03-21-mql-trading-bots.md b/2026-03-21-mql-trading-bots.md old mode 100644 new mode 100755 diff --git a/2026-03-21-mql-trading-report-analysis.md b/2026-03-21-mql-trading-report-analysis.md old mode 100644 new mode 100755 diff --git a/2026-03-30-dns-whitelist.md b/2026-03-30-dns-whitelist.md new file mode 100755 index 0000000..ac339c6 --- /dev/null +++ b/2026-03-30-dns-whitelist.md @@ -0,0 +1,16 @@ +# DNS Whitelist for Firewall + +**Date:** 2026-03-30 + +## IP Addresses to whitelist + +| Domain | IP Address | +|--------|-------------| +| chat.fetcherpay.com | 23.120.207.35 | +| git.fetcherpay.com | 23.120.207.35 | + +Both domains resolve to the same IP: **23.120.207.35** + +## Notes + +- Internal Gitea also available at: `10.152.183.192:3000` (Ubuntu server only, not for firewall whitelist) diff --git a/2026-03-30-weekend-gap-short-signal-fix.md b/2026-03-30-weekend-gap-short-signal-fix.md new file mode 100755 index 0000000..12f9653 --- /dev/null +++ b/2026-03-30-weekend-gap-short-signal-fix.md @@ -0,0 +1,138 @@ +# Session: 2026-03-30 - Weekend Gap Fix & Short Signal Fix + +## Participants +- **User**: Garfield (garfield@fetcherpay.com) +- **AI**: OpenCode CLI + +## Session Overview +Fixed two known issues from previous session: +1. Weekend gap risk on Grid EA +2. Short signal detection on Confluence EA + +--- + +## 1. Weekend Gap Risk Fix (Grid EA v3.1) + +### Problem +Positions held over weekend can gap 100-500+ pips on Sunday/Monday open, causing massive losses. + +### Solution Implemented +Added Friday position close feature: + +```cpp +//--- Weekend Protection +input bool InpCloseBeforeWeekend = true; // Enable Friday close +input int InpWeekendCloseHour = 17; // Close at 5 PM broker time +input bool InpCancelPendingBeforeWeekend = true; // Cancel pending orders too +``` + +New `CheckWeekendProtection()` function closes all positions Friday before weekend. + +### Files Modified +- `OrdersEA_Smart_Grid.mq5` - Added weekend protection (v3.1) + +--- + +## 2. Short Signal Detection Fix (Confluence EA v1.14) + +### Problem +EA was generating almost zero SHORT (SELL) trades. Historical data showed 0 shorts. + +### Root Cause +Restrictive `belowPivot = close < p` check was blocking all short signals when price was above pivot point. + +### Fix Applied +Removed asymmetric restriction - SELL logic now mirrors BUY logic: + +**Before:** +```cpp +if(nearResistance || (rejectedFromResistance && belowPivot)) // ❌ Too restrictive +``` + +**After:** +```cpp +if(nearResistance || rejectedFromResistance) // ✅ Mirrors BUY +``` + +Also relaxed harmonic pattern tolerances from `0.5-0.8` to `0.3-1.3`. + +### Files Modified +- `MultiSignal_Confluence_EA.mq5` - Fixed short signal detection (v1.14) + +--- + +## 3. Compilation Errors Fixed + +### Error 1: Missing #include +``` +#include +#include +``` + +### Error 2: Undeclared identifiers +- `abovePivot` / `belowPivot` - removed from debug print +- `gridPlaced` - moved to global scope + +--- + +## 4. Verification + +### Short Signal Verification Script +Created `verify-short-signals.py` to validate short signal logic. + +```bash +python3 verify-short-signals.py +``` + +Results: All checks passed ✅ + +--- + +## 5. File Deployment + +### Files Copied to MT5 +``` +~/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Experts/ +├── MultiSignal_Confluence_EA.mq5 (v1.14) +└── OrdersEA_Smart_Grid.mq5 (v3.1) +``` + +### Next Step +- Recompile in MT5 MetaEditor (F7) + +--- + +## 6. Git Commits + +| Commit | Description | +|--------|-------------| +| `d071b3c` | Fix weekend gap risk and short signal detection | +| `c53dff6` | (amend) Restore missing #include statements | +| `028a41b` | Fix: remove abovePivot/belowPivot debug references | +| `24f3d09` | Fix: make gridPlaced global for CheckWeekendProtection | + +--- + +## 7. Settings Files + +Existing `.set` files work without modification - new parameters use sensible defaults: +- `InpCloseBeforeWeekend = true` +- `InpWeekendCloseHour = 17` +- `InpCancelPendingBeforeWeekend = true` + +--- + +## 8. Next Steps + +1. **Test in MT5** - Load both EAs on demo account +2. **Monitor** - Watch for SELL signals on Confluence EA +3. **Verify weekend close** - Check Grid EA closes Friday at 5 PM +4. **Push to Gitea** - Run `git push` + +--- + +## Session Status: ✅ COMPLETE + +--- + +*Session recorded: 2026-03-30* diff --git a/2026-03-31-confluence-settings-update.md b/2026-03-31-confluence-settings-update.md new file mode 100755 index 0000000..efa182c --- /dev/null +++ b/2026-03-31-confluence-settings-update.md @@ -0,0 +1,55 @@ +# 2026-03-31 - Confluence EA Settings Update + +## Date: March 31, 2026 + +## Summary +Applied updated Confluence EA settings to all 10 MT5 charts. Verified settings via logs. + +## Actions + +### 1. Checked Local .set Files +Reviewed all confluence-*.set files in `/home/garfield/mql-trading-bots/`: +- standard, aggressive, relaxed (base profiles) +- eurusd, gbpjpy, gbpusd, audusd, usdjpy, eurjpy, usdcad, usdchf, nzdusd, xauusd (pair-specific) + +### 2. Found MT5 Wine Presets +Located in: `~/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Presets/` + +### 3. Applied Settings to Running EAs +User applied sets one by one, verified via log output: + +| Pair | Magic | Min Strength | Status | +|------|-------|--------------|--------| +| EURUSD | 777772 | 0.70 | ✓ | +| GBPJPY | 777780 | 0.75 | ✓ (fixed after reapply) | +| AUDUSD | 777777 | 0.71 | ✓ | +| GBPUSD | 777773 | 0.80 | ✓ | +| USDJPY | 777771 | 0.70 | ✓ | +| EURJPY | 777775 | 0.72 | ✓ | +| USDCAD | 777776 | 0.73 | ✓ | +| USDCHF | 777779 | 0.75 | ✓ | +| NZDUSD | 777778 | 0.72 | ✓ | +| XAUUSD | 777774 | 0.75 | ✓ | + +### 4. Risk Calculation Discovery +**Issue Found:** Both EAs (Confluence + Smart Grid) share the same daily drawdown limit. + +**Code Analysis:** +- `MultiSignal_Confluence_EA.mq5` lines 648-689: Daily drawdown uses `AccountInfoDouble(ACCOUNT_EQUITY)` +- Both EAs check same account equity, so they share the 3% daily limit +- Position counting IS correct (filters by symbol + magic number) + +**Implication:** If Smart Grid EA loses 2%, Confluence EA only has 1% remaining. + +## Decisions Pending +User is thinking about how to handle shared daily drawdown risk: +1. Lower Grid EA risk +2. Increase total daily drawdown (e.g., 5%) +3. Separate tracking per EA + +## Files Modified +- All confluence-*.set files synced to MT5 Presets directory + +## Next Steps +- Wait for user decision on risk management approach +- Potentially adjust Grid EA settings diff --git a/INFRASTRUCTURE.md b/INFRASTRUCTURE.md new file mode 100755 index 0000000..b78479f --- /dev/null +++ b/INFRASTRUCTURE.md @@ -0,0 +1,87 @@ +# Infrastructure Overview + +**Date:** 2026-03-30 + +## Server + +- **Public IP:** 23.120.207.35 +- **Hostname:** (check with `hostname`) +- **Operating System:** Ubuntu (likely 22.04 LTS) + +## Network + +| Network | Subnet | +|---------|--------| +| Primary | 23.120.207.35/22 | +| Docker bridge | 172.17.0.1/16 | +| Docker secondary | 172.18.0.1/16 | +| Docker tertiary | 172.19.0.1/16 | +| Docker quaternary | 172.20.0.1/16 | +| MicroK8s | 10.1.58.192/32 | + +## DNS Whitelist (Firewall) + +| Domain | IP Address | +|--------|-------------| +| chat.fetcherpay.com | 23.120.207.35 | +| git.fetcherpay.com | 23.120.207.35 | +| (internal Gitea) | 10.152.183.192:3000 | + +## Kubernetes (MicroK8s) + +- **Cluster:** microk8s-cluster +- **API Server:** https://23.120.207.35:16443 +- **Config:** ~/.kube/config +- **User:** admin + +## Traefik (Reverse Proxy) + +- **Config:** ~/traefik.yml +- **HTTP:** :80 (redirects to HTTPS) +- **HTTPS:** :443 +- **Dashboard:** Enabled (insecure) +- **Let's Encrypt:** admin@fetcherpay.com + +## Docker Containers (Running) + +| Container | Image | Ports | +|-----------|-------|-------| +| mt5 | gmag11/metatrader5_vnc:1.1 | 3000, 8001, 3001 | +| temporal-ui | temporalio/ui:latest | 8233->8080 | +| temporal | temporalio/auto-setup:latest | 6933-6935, 6939, 7233-7235, 7239 | +| adminer | adminer:latest | 8080 | +| fetcherpay-api | node:18-alpine | - | +| grafana | grafana/grafana:latest | 3000 | +| prometheus | prom/prometheus:latest | 9090 | +| mysql | mysql:8.0 | 3306, 33060 | + +## Gitea Runner + +- **Path:** ~/gitea-runner/ +- **Runner file:** .runner +- **Log:** runner.log + +## Project Repositories + +| Project | Path | +|---------|------| +| MQL Trading Bots | ~/mql-trading-bots/ | +| MT5 Docker | ~/mt5-docker/ | +| MT4 Docker | ~/mt4-docker/ | +| Fetcherpay Docs | ~/fetcherpay-docs/ | +| Fetcherpay K8s | ~/fetcherpay-k8s/ | +| Fetcherpay Marketing | ~/fetcherpay-marketing/ | +| Conversation History | ~/conversation-history/ | + +## K8s Deployments (from fetcherpay-k8s/) + +- fetcherpay-complete.yaml +- temporal-combined.yaml +- temporal-complete-stack.yaml +- temporal-ui-deployment.yaml +- poste-email.yaml + +## SSH Access + +- Current SSH connection: 192.168.1.65 (pts/4) +- Local users: garfield (seat0, :0, pts/4) diff --git a/README.md b/README.md old mode 100644 new mode 100755 index bb6cf3c..6fe0b09 --- a/README.md +++ b/README.md @@ -6,31 +6,54 @@ This repository stores session notes and project context for AI-assisted develop | Date | Project | Summary | File | |------|---------|---------|------| -| 2026-03-21 | MQL Trading Bots | Verified 19% profit, fixed bugs, migrated to Gitea | [2026-03-21-mql-trading-bots.md](2026-03-21-mql-trading-bots.md) | +| 2026-03-30 | Weekend Gap & Short Signals | Fixed weekend protection, short signal detection | [2026-03-30-weekend-gap-short-signal-fix.md](2026-03-30-weekend-gap-short-signal-fix.md) | +| 2026-03-29 | Settings Library | Created 24 .set files, critical bug fixes | [SESSION_SAVE_2026-03-29.md](SESSION_SAVE_2026-03-29.md) | +| 2026-03-21 | Initial Verification | Verified 19% profit, Gitea migration | [2026-03-21-mql-trading-bots.md](2026-03-21-mql-trading-bots.md) | ## How to Use This Repository +### For AI Agents: +1. Read `AGENTS.md` first - contains technical context +2. Check `conversation-history/` for session notes +3. Read latest README for current status + ### For Returning Users: 1. Read the latest session file for your project 2. Share the file content with AI at start of new session 3. AI will have full context of previous work -### For New Projects: -1. Create new session file: `YYYY-MM-DD-project-name.md` -2. Document what was built, configured, and decided -3. Include file locations, settings, and performance data -4. Commit and push to preserve context +--- ## Project Index -### Active Projects -- **mql-trading-bots** - MetaTrader EA development (profitable!) - - Repository: http://10.152.183.192:3000/garfield/mql-trading-bots - - Status: Active, ~19% return achieved - - Last Session: 2026-03-21 +### Active EAs -### Future Projects -(Add new projects here as they're started) +| EA | Version | Status | Purpose | +|----|---------|--------|---------| +| MultiSignal_Confluence_EA.mq5 | v1.14 | ✅ Active | Pivot+Candle+Harmonic confluence | +| OrdersEA_Smart_Grid.mq5 | v3.1 | ✅ Active | Grid trading around pivots | + +### Performance + +| Account | Period | Return | Win Rate | +|---------|--------|--------|----------| +| 104125640 | March 2026 | ~15-19% | 46-87% | +| 103477358 | February 2026 | ~4% | - | + +--- + +## Critical Fixes (Chronological) + +| Date | Version | Fix | +|------|---------|-----| +| 2026-03-21 | v1.11 | Stop loss cross-symbol contamination | +| 2026-03-21 | v1.12 | Volatility/ADX filters | +| 2026-03-29 | v1.13 | Daily drawdown protection | +| 2026-03-29 | v3.0 | Grid daily forced closure bug | +| 2026-03-30 | v1.14 | Short signal detection | +| 2026-03-30 | v3.1 | Weekend gap protection | + +--- ## Template for New Sessions @@ -39,7 +62,7 @@ This repository stores session notes and project context for AI-assisted develop ## Participants - User: [Name] -- AI: Kimi Code CLI +- AI: [AI Assistant] ## Session Overview Brief summary of what was done. @@ -60,16 +83,29 @@ Files modified, settings, configurations. What needs to be done next. ## Session Status: [IN PROGRESS / COMPLETE] +``` -## 📊 Trading Performance Reports +--- + +## Trading Performance Reports | Report | Date | Account | Return | File | |--------|------|---------|--------|------| -| Account 104125640 Analysis | 2026-03-21 | 104125640 | 6.9% | [2026-03-21-mql-trading-report-analysis.md](2026-03-21-mql-trading-report-analysis.md) | +| March Analysis | 2026-03-21 | 104125640 | 6.9% | [2026-03-21-mql-trading-report-analysis.md](2026-03-21-mql-trading-report-analysis.md) | ### Quick Stats - **Best Win Rate**: 86.67% (13/15 trades) - **Profit Factor**: 2.52 -- **Current Balance**: $106,935.12 (from $100k start) +- **Current Balance**: ~$115,000 (from $100k start) - **Strategy**: MultiSignal Confluence EA on USDJPY H1 +--- + +## Gitea Repository + +- **URL:** https://git.fetcherpay.com/garfield/mql-trading-bots +- **Last Push:** 2026-03-30 + +--- + +*Last Updated: 2026-03-30* diff --git a/REPOSITORIES.md b/REPOSITORIES.md old mode 100644 new mode 100755 diff --git a/SESSION_SAVE_2026-03-22.md b/SESSION_SAVE_2026-03-22.md old mode 100644 new mode 100755 diff --git a/TEMPLATE.md b/TEMPLATE.md old mode 100644 new mode 100755