Files
conversation-history/Trading/MT5/Codex-2026-05-12-OrdersEA-Commodities-Separate-Analysis.md
T

185 lines
8.2 KiB
Markdown

# Codex 2026-05-12 OrdersEA Commodities Separate Analysis
## Scope
This note separates the commodity charts from the broader OrdersEA Smart Grid / Confluence analysis:
- `XAUUSD` (gold)
- `XAGUSD` (silver)
Primary sources checked:
- `/home/garfield/mt5-docker/config/.wine/drive_c/users/abc/Desktop/ReportHistory05112026-10010515865.html`
- `/home/garfield/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Logs/20260511.log`
- `/home/garfield/mt5-docker/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Logs/20260512.log`
- Repo presets: `grid-xauusd.set`, `grid-xagusd.set`, `confluence-xauusd.set`, `confluence-xagusd.set`
## Executive Finding
The commodity loss should not be treated as one generic "commodities" result.
`XAGUSD` caused the large May 11 commodity loss, and the root cause is most likely operational: silver was initially running under the gold grid magic/settings (`333010`) before being reloaded correctly under the silver magic (`333018`).
`XAUUSD` behaved more normally for the grid strategy: many small TP wins and one larger forced/cleanup-style loss. Gold still has poor payoff asymmetry, but it was not the main commodity damage in the May report.
## Report Split
Closed commodity deal summary from the May report:
| Symbol | Closed Deals | Wins | Losses | Gross Profit | Gross Loss | Net |
|---|---:|---:|---:|---:|---:|---:|
| `XAUUSD` | 20 | 19 | 1 | +$22.80 | -$38.63 | -$15.83 |
| `XAGUSD` | 2 | 0 | 2 | +$0.00 | -$154.65 | -$154.65 |
Key individual XAGUSD losses:
| Time | Symbol | Exit | P&L |
|---|---|---:|---:|
| 2026-05-11 16:00:00 | `XAGUSD` | 83.623 | -$79.95 |
| 2026-05-11 16:00:00 | `XAGUSD` | 83.598 | -$74.70 |
Key XAUUSD loss:
| Time | Symbol | Exit | P&L |
|---|---|---:|---:|
| 2026-05-01 17:00:00 | `XAUUSD` | 4627.05 | -$38.63 |
## Preset / Magic Comparison
Correct gold grid preset:
- File: `grid-xauusd.set`
- `MagicNum=333010`
- `Entry=80`
- `TP=120`
- `MaxLevels=2`
- `ATRMultiplier=2.5`
Correct silver grid preset:
- File: `grid-xagusd.set`
- `MagicNum=333018`
- `Entry=250`
- `TP=400`
- `MaxLevels=4`
- `ATRMultiplier=2.0`
The May 11 logs show silver first running as `XAGUSD:333010`:
```text
OrdersEA_Smart_Grid (XAGUSD,H1) [XAGUSD:333010] Placing grid ... entry=80pts levels=2
OrdersEA_Smart_Grid (XAGUSD,H1) [XAGUSD:333010] Closed 2 SELL positions: Edge cleanup - above GridHigh
```
That is gold-style grid geometry on silver. Later the same day, silver was reloaded correctly:
```text
OrdersEA_Smart_Grid (XAGUSD,H1) [XAGUSD:333018] Version 4.1 Smart Grid MT5 initialized - Magic=333018
OrdersEA_Smart_Grid (XAGUSD,H1) [XAGUSD:333018] AutoPivots: HIGH=82.270 LOW=78.102 ATR=1.042
```
On May 12, silver was still correctly running as `333018` and used the wider silver spacing:
```text
OrdersEA_Smart_Grid (XAGUSD,H1) [XAGUSD:333018] Placing grid - px=83.945 [81.895-85.703] entry=250pts levels=4
```
## First-Principles Reasoning
### 1. A grid system wins by harvesting mean reversion, not by predicting trends
The grid places limits around a range. If price oscillates, it captures small TPs. If price trends through the range, wrong-side positions become structurally disadvantaged.
For commodities, this problem is amplified because:
- intraday moves are larger than majors,
- spreads are wider and less stable,
- US-session/news moves can be abrupt,
- `0.01` lots can still represent materially larger dollar movement than a small FX grid.
### 2. Using gold spacing on silver changes the risk model
Gold preset on silver means:
- `Entry=80` instead of silver's intended `250`
- `TP=120` instead of silver's intended `400`
- `MaxLevels=2` instead of silver's intended `4`
- `MagicNum=333010` instead of `333018`
That makes silver entries much tighter than intended. A normal silver move can cross the entire gold-style grid quickly, trigger edge cleanup, and realize a large loss.
The May 11 loss matches that exact pattern: silver sold near `82.024/82.104`, then exited around `83.598/83.623` for about `1.5` silver points against the trade.
### 3. v5.0 edge cleanup did its job, but on a misconfigured chart
The v5.0 cleanup closes wrong-side positions when price exits the grid band:
- above `GridHigh`: close SELLs
- below `GridLow`: close BUYs
For correctly configured symbols, this prevents stranded positions from bleeding until Friday. For misconfigured silver, it converted the setup mistake into an immediate realized loss. That is painful, but preferable to letting the same wrong-side silver position drift further.
### 4. XAUUSD still has weak payoff asymmetry
Gold's May sample is:
- 19 wins at about `$1.20` each
- 1 loss at `-$38.63`
- net `-$15.83`
This is not a magic/preset mismatch. It is the normal grid payoff problem: many tiny winners can be wiped out by one forced or edge-management loss. Gold therefore needs separate controls, but it is not the same failure mode as silver.
## Self-Questions And Answers
### Q1. Could XAGUSD's loss be normal silver behavior rather than a wrong preset?
Unlikely. The log directly shows `XAGUSD:333010` placing `entry=80pts levels=2`, which matches gold's preset, not silver's intended `entry=250pts levels=4`. The report's losing silver orders match the `333010` grid order tickets from that earlier run. Confidence: 97%.
### Q2. Could Confluence have caused the commodity losses?
Unlikely for the May 11 XAGUSD loss. The losing report comments and log path are `SG Sell`, and Confluence logs show mostly `Strength too low` or filter blocks. XAUUSD/XAGUSD Confluence instances were present, but the losing silver trades were OrdersEA grid trades. Confidence: 95%.
### Q3. Did v5.0 edge cleanup create a new bug?
Not in the evidence checked. It changed when the loss is realized. Before v5.0, the same wrong-side position could remain open until weekend protection or a wider breakout. After v5.0, it closes at the grid edge. The edge cleanup exposed the loss earlier; it did not create the bad entry. Confidence: 92%.
### Q4. Is XAUUSD safe because it only lost `$15.83` net?
No. The small net loss hides poor expectancy: 19 wins could not offset one larger loss. Gold needs either stricter entry timing, no-new-grid windows, wider buffers, or reduced lot exposure if it stays enabled. Confidence: 91%.
### Q5. Is XAGUSD safe now that it is on `333018`?
Safer operationally, but not proven profitable. May 12 shows the correct silver configuration mostly being blocked by spread/ADX, which is good. It placed a correct silver grid once and then cancelled pending orders when range conditions failed. There is not enough post-correction closed-trade sample to call it profitable. Confidence: 93%.
## Confidence Assessment
| Claim | Confidence |
|---|---:|
| May 11 XAGUSD loss came from silver running under gold magic/settings | 97% |
| XAGUSD should be excluded from normal commodity strategy evaluation before reload to `333018` | 96% |
| XAUUSD loss is normal grid payoff asymmetry, not the same magic mismatch | 92% |
| v5.0 edge cleanup surfaced losses earlier rather than creating the original wrong-side exposure | 92% |
| Commodities need separate operating rules from FX pairs | 94% |
Overall confidence: 94%.
## Practical Operating Rules
1. Do not evaluate pre-reload XAGUSD performance as valid silver strategy performance.
2. Keep XAGUSD only on `MagicNum=333018`.
3. Keep XAUUSD only on `MagicNum=333010`.
4. Do not run either commodity chart after changing presets unless the chart properties confirm symbol, magic, entry, TP, max levels, and lot size.
5. Keep commodity lots conservative until edge cleanup has multiple weeks of correctly configured data.
6. Treat XAGUSD spread blocks as useful protection; do not loosen `InpMaxSpreadPoints` without a separate spread-cost analysis.
7. Treat XAUUSD as still unproven despite high win rate because its winner/loss ratio is poor.
## Recommended Next Checks
- Verify MT5 chart properties for XAGUSD: `MagicNum=333018`, `Entry=250`, `TP=400`, `MaxLevels=4`.
- Verify MT5 chart properties for XAUUSD: `MagicNum=333010`, `Entry=80`, `TP=120`, `MaxLevels=2`.
- Add a startup log line that prints `Entry`, `TP`, `MaxLevels`, and `ATRMultiplier` so future preset mismatches are visible immediately.
- Consider adding a hard symbol/magic guard:
- if `_Symbol=="XAGUSD"` and `MagicNum==333010`, refuse to trade;
- if `_Symbol=="XAUUSD"` and `MagicNum==333018`, refuse to trade.