Compare commits

..

2 Commits

Author SHA1 Message Date
ffa3fd7799 Add April 5 session: Grid shutdown analysis 2026-04-05 08:41:06 -04:00
fe4fe656be Update conversation history and add recent notes 2026-04-03 16:57:52 -04:00
17 changed files with 449 additions and 17 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
.idea/.gitignore generated vendored Normal file → Executable file
View File

0
.idea/conversation-history.iml generated Normal file → Executable file
View File

0
.idea/misc.xml generated Normal file → Executable file
View File

0
.idea/modules.xml generated Normal file → Executable file
View File

0
.idea/vcs.xml generated Normal file → Executable file
View File

0
2026-03-21-mql-trading-bots.md Normal file → Executable file
View File

0
2026-03-21-mql-trading-report-analysis.md Normal file → Executable file
View File

16
2026-03-30-dns-whitelist.md Executable file
View File

@@ -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)

View File

@@ -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 <Trade\Trade.mqh>
#include <Trade\PositionInfo.mqh>
```
### 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*

View File

@@ -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

View File

@@ -0,0 +1,100 @@
# Session: 2026-04-05 - Trading Log Analysis & Grid EA Shutdown Decision
## Participants
- **User**: Garfield (garfield@fetcherpay.com)
- **AI**: opencode
## Session Overview
Analyzed MT5 trading logs from March-April 2026 to understand why Confluence EA stopped trading. Discovered shared drawdown issue between both EAs.
---
## 1. Log Analysis Findings
### Grid EA Issues (OrdersEA_Smart_Grid)
- Placed **dozens of grid orders per hour** on multiple pairs
- March 31: Grid after grid placed and filled (6-10 buy + 6-10 sell stops per cycle)
- When market moved against position, all levels filled → cascading losses
- **Root cause of ~$60K loss**: Earlier in March (Mar 24-30) with clustering bug
### Confluence EA Status
- Continuously **blocked by low signal strength** (0.00 < 0.70-0.85)
- **Volatility filters working** (ATR too low: 0.13-0.20% < 0.30%)
- Filters working as designed - market was choppy/ranging
- No drawdown protection triggered in recent logs
### Grid Clustering Fix (Already Applied April 1)
- Logs show "too close to price. Skipping" (fix working)
- Pre-April 1 logs showed old "Adjusting" behavior
---
## 2. Equity Timeline from Logs
| Date | Time | Equity | Event |
|------|------|--------|-------|
| Mar 31 | 08:34 | $107,036 | Daily reset |
| Apr 1 | 15:11 | $106,952 | Declining |
| Apr 1 | 17:00 | $106,896 | End of day |
| Apr 2 | 17:00 | $107,084 | New day reset |
---
## 3. Critical Discovery: Shared Drawdown
**Issue**: Both EAs share the same 3% daily drawdown limit.
From `2026-03-31-confluence-settings-update.md`:
- Both EAs check `AccountInfoDouble(ACCOUNT_EQUITY)`
- Position counting IS correct (filters by symbol + magic)
- **Implication**: If Grid EA loses 2%, Confluence only has 1% remaining
**Code Location**:
- `MultiSignal_Confluence_EA.mq5` lines 648-689
- `OrdersEA_Smart_Grid.mq5` - similar daily drawdown logic
---
## 4. Decision: Shutdown Grid EA
**User Action**: Shut down Grid EA for the week to test if it's hogging equity.
**Reasoning**:
- Grid EA consuming daily drawdown budget
- Confluence EA blocked despite good signal filters
- Separating the two might allow Confluence to trade
**Steps**:
1. Disable/remove Grid EA from all charts
2. Restart Confluence EA to clear daily equity tracking
3. Monitor for Confluence trades over next few days
---
## 5. What to Watch After Grid Shutdown
1. **Confluence should have full 3% daily budget** - more room to trade
2. **If still no trades**:
- Still-ranging market (low ATR/ADX)
- Signals below minimum strength (0.70-0.90)
- Need MT5 restart to reset drawdown tracking
3. **If trades resume** - Grid was hogging equity
---
## 6. Current Status (April 5, 2026)
- **Grid EA**: Being disabled this week
- **Confluence EA**: Running, awaiting trading opportunity
- **Market conditions**: Low volatility/ranging (ATR filters blocking)
- **Account**: ~$47% equity (still recovering)
---
## Session Status: IN PROGRESS
Monitoring Confluence EA behavior without Grid EA competition.
---
*Session recorded: 2026-04-05*

87
INFRASTRUCTURE.md Executable file
View File

@@ -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)

70
README.md Normal file → Executable file
View File

@@ -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*

0
REPOSITORIES.md Normal file → Executable file
View File

0
SESSION_SAVE_2026-03-22.md Normal file → Executable file
View File

0
TEMPLATE.md Normal file → Executable file
View File