WIP: 6+ weeks of uncommitted EA development and preset tuning

Confluence EA (v1.16 → v1.20):
- Per-EA realized P&L tracking via history deals
- Weekly drawdown protection
- Warmup bars, pivot cache, state persistence
- Point-scaled pivot thresholds, ranging ATR factor
- Market filling mode helper per symbol

Grid EA (v3.1 → v4.1):
- Adaptive filters, adaptive entry, spread filter
- Session filter, breakeven, correlation caps, range drift
- Profit protection (stop-after-profit, cycle reports)
- Edge cleanup v5.0 — close wrong-side positions outside grid
- Master one-shot shutdown, grid state persistence

Presets:
- Fix GetOut=Y shutdown bug on 4 grid presets
- Relax ADXMax 18→40, widen RSI 20/80 across grid presets
- Standardize daily drawdown 3%→5%, add weekly 10%
- Increase grid lots 0.01→0.03
- Normalize confluence ATR thresholds per pair
- Add XAGUSD, EURCHF, EURGBP, AUDNZD presets

Docs & DevOps:
- April 23 audit files (preset mismatch, code review, checklist)
- n8n workflow and validation infrastructure updates
- AI agent analyses in notes/

Known issues carried forward:
- Shared drawdown budget contamination (both EAs)
- Confluence ranging-market threshold inversion
- Older grid presets missing v4.1 safety controls
This commit is contained in:
2026-05-12 09:02:25 -04:00
parent b9b4e2b22b
commit 0894d18db4
72 changed files with 3869 additions and 1416 deletions
@@ -0,0 +1,67 @@
# 2026-04-23 OrdersEA Smart Grid - Fix Checklist
This is a concrete follow-up checklist derived from the read-only code review. No code changes have been made yet.
## Immediate
- [ ] Normalize live presets so `GetOut` is valid on every active chart.
- [ ] Verify live chart `MagicNum` values match intended pair presets.
- [ ] Confirm whether the EA should keep stacking same-side levels after first fill, or intentionally stop after first fill per side.
- [ ] Keep `InpUseBreakeven=false` on live charts until breakeven behavior is intentionally redesigned and retested.
## Code Fixes
### 1. Preset semantics
- [ ] Fix preset usage so `GetOut=Y` is not used as a safety toggle.
- [ ] Decide whether `GetOut` should remain a shutdown input only, or whether a separate boolean safety flag is needed.
### 2. Grid lifecycle logic
- [ ] Review same-side pending-order cancellation logic in `OnTick()`.
- [ ] Align the implementation with the intended strategy:
- classic multi-level averaging grid, or
- one-fill-per-side range system.
- [ ] Update comments so they match actual behavior.
### 3. P&L isolation
- [ ] Remove whole-account contamination from daily drawdown baseline.
- [ ] Remove whole-account contamination from weekly drawdown baseline.
- [ ] Remove whole-account contamination from `cycleStartEquity`.
- [ ] Remove whole-account contamination from `InpStopAfterProfit`.
- [ ] Remove whole-account contamination from `CheckProfitTarget()`.
### 4. Breakeven redesign
- [ ] Decide what breakeven should actually mean:
- true breakeven,
- spread-protected breakeven,
- or partial profit lock.
- [ ] Add broker-rule checks before `PositionModify()`.
- [ ] Add per-ticket retry backoff so rejected modifications do not flood logs.
### 5. Filter relaxation
- [ ] Change adaptive relaxation to consider “no grid placed” rather than only `lastTradePlacedTime`.
- [ ] Confirm whether symbols that never traded should still relax after N idle days.
## Preset Modernization
- [ ] Add session filter settings to older presets.
- [ ] Add spread caps to older presets.
- [ ] Add correlation cap settings to older presets.
- [ ] Add explicit breakeven settings to older presets.
- [ ] Add explicit adaptive-filter settings to older presets.
- [ ] Review whether `BaseEquity=10000` should remain the standard preset default.
## Validation
- [ ] Re-run preset audit after edits.
- [ ] Re-check live charts in MT5 to confirm loaded settings match repo presets.
- [ ] Watch logs for:
- invalid stops
- repeated modify failures
- unexpected GetOut shutdowns
- mismatched MagicNum usage
## Decision Points
- [ ] Choose the intended OrdersEA model: true grid vs limited range system.
- [ ] Decide whether session filter should be default ON for all grid presets.
- [ ] Decide whether per-cycle logic should use balance-based or EA-isolated P&L tracking.