Files
conversation-history/2026-04-07-confluence-ea-diagnosis.md
T

156 lines
6.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Session: 2026-04-07 - Confluence EA Diagnosis & ATR/ADX Filter Root Cause
## Participants
- **User**: Garfield (garfield@fetcherpay.com)
- **AI**: Claude Code (claude-sonnet-4-6)
## Session Overview
Read and analyzed all conversation history files. Checked live MT5 logs for running Confluence EA instances. Identified root cause of zero trading activity since Apr 5: ATR thresholds were set far too high (0.8%) in a previous session, blocking all trades silently because debug mode is off.
---
## 1. Conversation History Analysis
### Files Reviewed
All files in `conversation-history/`:
- `2026-03-21-mql-trading-bots.md` — Origin, stop-loss bug fix (v1.11), Gitea migration, ~19% profit confirmed
- `2026-03-21-mql-trading-report-analysis.md` — Account 104125640 report: 86.67% win rate, 2.52 profit factor
- `2026-03-30-weekend-gap-short-signal-fix.md` — Weekend gap protection (v3.1), short signal fix (v1.14)
- `2026-03-31-confluence-settings-update.md` — Per-pair settings applied, shared drawdown risk discovered
- `2026-03-31-devops-infrastructure.md` — IP update to 104.190.60.129, AT&T router opened
- `2026-04-01-mt5-analysis-and-fixes.md` — Grid clustering bug fix, .set file parameter name fix, unique magic numbers
- `2026-04-03-confluence-ea-analysis.md` — Crisis analysis: Grid EA caused ~$60K loss, equity at 47%
- `2026-04-05-grid-shutdown-analysis.md` — Grid EA shutdown decision to free shared drawdown budget
### Key Timeline Recap
| Date | Event |
|------|-------|
| Feb 2025 | EAs created (Pivot + Harmonic + Candlestick = Confluence) |
| Mar 21 | ~19% profit confirmed, stop-loss cross-symbol bug fixed (v1.11) |
| Mar 22 | Account at $106,935 (+6.94%), Grid EA added — turning point |
| Mar 24-30 | Grid EA clustering bug caused ~$60K loss |
| Mar 30 | Weekend gap + short signal fixes |
| Mar 31 | Shared daily drawdown risk identified |
| Apr 1 | Grid clustering fix, .set files fixed (wrong param names), InpStopAfterProfit added |
| Apr 3 | Equity at 47% (~$47K), Confluence halted by drawdown protection |
| Apr 5 | Decision: shut down Grid EA for the week |
| Apr 7 | Confluence still not trading — this session's diagnosis |
---
## 2. Live EA Properties (from 20260407.log)
MT5 restarted at 08:27 today. All 8 instances initialized as **v1.18**.
| Pair | Magic | Min Strength | Min Confluence | Volatility Filter | ADX Filter | Trailing Start | Trailing Stop | Trailing Step | Weekend Close |
|------|-------|-------------|----------------|------------------|-----------|----------------|--------------|--------------|---------------|
| USDJPY | 777771 | 0.70 | 2 | ON | ON | 50 pts | 30 pts | 10 pts | 17:00 |
| EURUSD | 777772 | 0.70 | 2 | ON | ON | 50 pts | 30 pts | 10 pts | **14:00** ⚠️ |
| USDCHF | 777779 | 0.75 | 2 | ON | ON | 40 pts | 35 pts | 30 pts | 17:00 |
| NZDUSD | 777778 | 0.72 | 2 | ON | ON | 55 pts | 45 pts | 35 pts | 17:00 |
| GBPUSD | 777773 | 0.80 | 2 | ON | ON | 75 pts | 75 pts | 50 pts | 17:00 |
| USDCAD | 777776 | 0.73 | 2 | ON | ON | 60 pts | 50 pts | 40 pts | 17:00 |
| XAUUSD | 777774 | 0.75 | 2 | ON | ON | 200 pts | 150 pts | 100 pts | 17:00 |
| EURJPY | 777775 | 0.72 | 2 | ON | ON | 60 pts | 45 pts | 35 pts | 17:00 |
**Missing**: GBPJPY (777780) and AUDUSD (777777) — confirmed absent from Apr 6 and Apr 7 logs. These were Grid-EA-only charts, removed when Grid EA was shut down.
**Note**: EURUSD weekend close is at 14:00, not 17:00 like all others — may be intentional (London close) but worth verifying.
**Daily equity reset**: $107,084.50 on all instances. Account has recovered from the ~$47K low noted Apr 3 (likely MetaQuotes demo reset or natural recovery before Apr 5).
---
## 3. Root Cause: Zero Trades Since Apr 5
### Finding 1: ATR Thresholds Set Too High
The `.set` files were "tightened" in a previous session. `InpMinATRPercent` was set to **0.8%** for all pairs (1.0% for XAUUSD). This is far above normal H1 ATR values:
| Pair | Typical H1 ATR% | Set Threshold | Verdict |
|------|----------------|--------------|---------|
| EURUSD | 0.27–0.45% | 0.8% | **BLOCKED** |
| USDJPY | 0.23–0.37% | 0.8% | **BLOCKED** |
| GBPUSD | 0.31–0.46% | 0.8% | **BLOCKED** |
| USDCHF | 0.25–0.40% | 0.8% | **BLOCKED** |
| NZDUSD | 0.28–0.42% | 0.8% | **BLOCKED** |
| USDCAD | 0.28–0.42% | 0.8% | **BLOCKED** |
| EURJPY | 0.35–0.55% | 0.8% | **BLOCKED** |
| XAUUSD | 0.50–0.90% | 1.0% | **BORDERLINE** |
### Finding 2: Ranging Market Detection Compounds the Problem
Code at `MultiSignal_Confluence_EA.mq5:262`:
```cpp
adxWeak = (adxValue[0] < 20.0); // hardcoded — NOT using InpMinADX
```
When ADX < 20 AND 5+ bars in a channel → `isRangingMarket = true`. In ranging mode:
- `effectiveMinATR = InpMinATRPercent * 1.5` → **0.8% × 1.5 = 1.2%** (essentially unreachable)
- `effectiveMinADX = InpMinADX + 5.0` → e.g. **22 + 5 = 27**
This week's tariff-driven market: big price moves but **no directional trend** = low ADX + high but choppy ATR. The EA classifies this as ranging and applies the stricter multiplier. Total block.
### Finding 3: Debug Mode OFF = Silent Failures
All filter block print statements are gated behind `InpDebugMode`:
```cpp
// Line 331
if(InpDebugMode) Print("Volatility filter BLOCKED: ATR too low...");
// Line 356
if(InpDebugMode) Print("ADX filter BLOCKED: Trend too weak...");
```
Since debug mode is OFF, every blocked signal is silently dropped. The log only shows initialization — nothing about why trades aren't firing.
---
## 4. Recommended Fixes (Not Yet Applied)
### A. Lower ATR Thresholds in .set files
| Pair | Current | Recommended |
|------|---------|-------------|
| EURUSD | 0.8% | 0.3% |
| USDJPY | 0.8% | 0.3% |
| GBPUSD | 0.8% | 0.4% |
| USDCHF | 0.8% | 0.3% |
| NZDUSD | 0.8% | 0.35% |
| USDCAD | 0.8% | 0.35% |
| EURJPY | 0.8% | 0.4% |
| XAUUSD | 1.0% | 0.7% |
Also lower ADX thresholds from 22-28 back to 18-22 range.
### B. Enable Debug Mode Temporarily
Add `InpDebugMode=true` to each .set file so filter blocks appear in the MT5 journal.
### C. Optional: Fix EURUSD Weekend Close Hour
EURUSD shows `Close Hour: 14:00` — verify if this is intentional or a misconfiguration.
---
## 5. Outstanding Issues (Carry Forward)
1. **ATR thresholds not yet fixed** — pending user confirmation
2. **Shared daily drawdown** — both EAs (if Grid EA is re-enabled) share account-level 3% limit. Code fix needed.
3. **GBPJPY/AUDUSD charts** — not running Confluence. Add if desired.
4. **EURUSD weekend close at 14:00** — verify intent.
---
## 6. Next Steps
- [ ] Update all `.set` files with corrected ATR thresholds
- [ ] Enable `InpDebugMode=true` in `.set` files temporarily
- [ ] Reload `.set` files on each MT5 chart
- [ ] Monitor journal for filter block messages to confirm diagnosis
- [ ] Decide on GBPJPY/AUDUSD — add Confluence EA or leave as-is
- [ ] Fix EURUSD `InpWeekendCloseHour` if incorrect
---
## Session Files Modified/Created
- `conversation-history/2026-04-07-confluence-ea-diagnosis.md` — This file
## Session Status: IN PROGRESS — Fix pending user approval