Root cause: MT5 actually reads live EA inputs from
MQL5/Profiles/Charts/Default/chartNN.chr at boot, not from the .set
presets -- and it never rewrites that file on container shutdown
(files were found frozen at their Aug 6 mtimes through every restart
since, including graceful ones with stop_grace_period). This is why
the XAUUSD spread-filter fix (Jul 30) and the Monday A/B reversion
(Aug 10) both kept reverting after restarts.
sync-ea-inputs.sh (+ .py) runs on every container boot via
custom-cont-init.d, before MT5 launches, and writes each chart's
matching bo-*.set values directly into its .chr cache -- bypassing
MT5's broken save-on-exit path entirely. Validated with a real
corrupt-then-restart-then-verify cycle (see vault note).
Deployed copy lives at ~/mt5-docker/custom-cont-init.d/ (mt5-docker
is not a git repo); this is the tracked source, kept in sync with the
deployed version by hand like the other scripts here (e.g.
export-history.sh).
4 Mondays complete (Jul 20, 27, Aug 3, 10). Cumulative signal never
resolved cleanly — DP1's single GBPUSD whipsaw cluster drove nearly
the entire A-B gap, DP3 had zero B-cohort trades, DP2/DP4 were small
and mixed. Reading this as "within noise" per the pre-registered
decision rule: keep the fleet on the simpler midnight-ET resume
(hour=7) rather than adopting London-open timing on a single outlier
session.
InpMondayStartHour: 10 -> 7 for GBPUSD, USDJPY, EURCHF, AUDUSD,
EURGBP, GBPJPY (the B-cohort). A-cohort (EURUSD, EURJPY, USDCHF,
NZDUSD, USDCAD, AUDNZD) was already at 7 throughout.
GridHigh/GridLow are never persisted (only lastPivotCalcDate is), so if
two restarts land close together near a server-day boundary, a fresh
process can find lastPivotCalcDate already matching 'today' and skip
CalculatePivotPoints() entirely -- leaving the band at its uninitialized
0/0 and every IsRangingMarket() check failing 'Invalid grid bounds' until
the next real day rollover. Cost XAUUSD/XAGUSD ~17h of dead trading on
2026-07-23 after the drift-enable and sizing deploys landed back-to-back.
Fix: both the OnInit guard and the OnTick day-rollover guard now also
recalc when GridHigh<=0 || GridLow<=0, regardless of date match. The
OnTick path recalcs only (no cancel/reset side effects) when it's the
same-day self-heal case, since that's not a real day transition.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per user decision 2026-07-22/23, applying the endorsed sizing from the
metals sizing review (skipping the 'temporary ceiling' variant). Caps
per-position risk at ~$1,125 gold / ~$1,750 silver (vs $1,500/$5,000
at 1.00 lot); tail case (4 stops both sides, both symbols) now ~$5,750
(~5.1% of $111k equity) vs the prior ~$26k. Cross-EA combined-risk cap
(the doc's other ask) remains a separate future v5.7 task -- not yet
built, so the account-level dollar cap is not enforced, only the
per-symbol lot reduction.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Both metals sat above their daily pivot band all week (Jul 20-22) with
zero fills: the no-trade-zone guard correctly refused buy-stops too
close to price, and the once-daily pivot recalc meant the band never
re-anchored once price drifted away and stayed there. CheckRangeDrift()
already existed for this (disabled everywhere); enabling it for the two
metals lets the band re-center intraday once price drifts ~1x hourly ATR
from the midpoint, without touching FX presets which don't show this
problem.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Wind-down (Thu 19:00 server = Thu noon ET -> weekend close): cancel
entry pendings, no new grids, trail tightened to 200/150pts so open
positions walk out at their natural end instead of being chopped at the
midnight deadline. Hard close unchanged as backstop.
Shadow metric: first tick of each new server week, every EA reports what
its weekend-flattened positions would have done through Friday (MTM at
Friday's last H1 close + worst adverse excursion) — quantifies the cost
of the no-Friday policy from live data.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Twin-matched split vs A-cohort at 7:00 (midnight ET). 4-Monday experiment
starting Jul 20; pre-registered decision rule in the vault note.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The ea-watchdog inferred tick starvation from expert-log silence, but a
stable placed grid is also silent — it restart-looped the container 11
times on Jul 15-16. The heartbeat fires on any tick once per hour before
every gate (weekend block, stand-down, drawdown), so silence >1h during
market hours now unambiguously means a dead chart feed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
100 pips was reachable on metals only — FX winners kept cycle-closing
before the trail engaged (GBPUSD +70 pips Jul 15 had an unmoved SL).
Input renamed InpTrailStart -> InpTrailStartPoints so every chart picks
up the new 500 default on recompile without per-chart preset reloads;
metal presets set it back to 1000 explicitly.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Monday's pivots and ATR are built from Friday's session and the first
server hours are the thin Sunday-evening ET market — historically the
only losing weekday (-$121 across 204 trades vs all other days
positive). New CheckMondayStandDown() blocks new grids on Monday
before InpMondayStartHour (default 7 = midnight ET), and because it
sits above the daily pivot recalc, Monday's pivots/ATR are sampled at
the resume hour instead of the rollover. All 17 presets set
InpMondayStartHour=7. Trading week is now Mon 00:00 ET -> Fri 00:00 ET.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CheckWeekendProtection previously returned true after the one-shot
weekend close, so the EA resumed placing new grids for the rest of
Friday. Now it stays blocked until the next trading day and keeps
sweeping stray positions/pendings while blocked.
All 17 presets: InpWeekendCloseHour 17 -> 7 (server UTC+3), closing
everything at Friday 07:00 server = Thursday midnight ET, per the
no-weekend-carry policy.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ApplyTrailingStop() runs every 5s on open positions: activates after
1000 pts (100 pips) of profit, trails SL 500 pts (50 pips) behind price.
SL only moves in the profitable direction, never backwards.
New inputs: InpUseTrailingStop, InpTrailStart, InpTrailStop (all presets
set to true/1000/500). EA version bumped 5.0 → 5.1.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0.10 -> 1.00 across all 17 set files. At last week's performance
this projects to ~+$7,600 net on a good trending week.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Uniform increase on all 17 set files (14 per-pair + 3 templates).
At 0.10 lots last week's +$76 net would have been ~+$760.
SL exposure also 10x: AUDNZD/majors ~$10/hit, volatile pairs ~$27/hit.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Breakout variant of the Smart Grid: uses BUY_STOP/SELL_STOP orders
above resistance and below support rather than mean-reversion limits.
Only trades when trending (ADX filter inverted vs. Grid EA), cancels
orders when market returns to range. Mandatory SL on all presets.
Includes 17 .set files: 3 templates (major/volatile/steady) and 14
per-pair presets covering all Grid EA pairs plus EURCHF, EURGBP,
AUDNZD, XAUUSD, XAGUSD.
First live week (Jun 22–26): +$84.71 from 8 completed cycles.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- AGENTS.md: Technical context for AI assistants
- QUICKREF.md: Quick reference card
- README.md: Updated with version history and performance
- conversation-history/README.md: Updated session index
- 2026-03-30-weekend-gap-short-signal-fix.md: Session notes
Grid EA (v3.1):
- Add weekend protection: close positions Friday before market close
- New settings: InpCloseBeforeWeekend, InpWeekendCloseHour, InpCancelPendingBeforeWeekend
- Prevents gap risk when market reopens Sunday/Monday
- FIX: Restore missing #include statements
Confluence EA (v1.14):
- Fix short signal detection by removing restrictive 'belowPivot' check
- Mirror BUY and SELL logic for symmetry
- Relax harmonic pattern tolerances (0.3-1.0 vs 0.5-0.8)
- Short signals now match buy signal generation
Add verify-short-signals.py to test short signal generation
New Features:
- InpUseRiskPercent: Enable risk-based lot sizing
- InpRiskPercent: Risk % per trade (default 1.0%)
- CalculateLotSize(): Dynamic lot calculation based on:
* Account balance
* Risk percentage
* Stop loss distance
* Symbol tick value/size
Lot size formula: Risk$ / (SL_Points * TickValue/TickSize)
Automatically adjusts lot size as account grows/shrinks.
Falls back to fixed InpLotSize if UseRiskPercent=false.
New functions:
- CancelAllOrders(reason): Cancels all pending orders with logging
- CloseAllPositions(reason): Closes all open positions
- IsBreakout(): Detects when price breaks S2/R2
Order cancellation triggers:
1. ADX rises (trend starts) - Cancel all, wait for ranging
2. Price breaks S2/R2 (breakout) - Cancel all, close positions
3. Buy positions fill - Cancel remaining buy stops (avoid overexposure)
4. Sell positions fill - Cancel remaining sell stops
5. End of day (00:00) - Cancel all, close positions, reset grid
This prevents:
- Orphaned orders when trend starts
- Overexposure when one side fills
- Old orders from previous day causing issues
Added missing input variables:
- input int EquityFactorPercent= 0;
- input int LotsFactorPercent= 0;
These were referenced in CalcLots() function but not declared.
Changed initEquity from int to double to fix:
- Line 217: double - int subtraction
- Line 226: int * double / double calculation
- Added explicit cast for BaseEquity assignment
This resolves implicit type conversion warnings/errors in MT5.
Full MQL4 to MQL5 conversion:
- Replaced OrderSend with CTrade::OrderSend
- Replaced MarketInfo with SymbolInfoDouble/Integer
- Replaced Bid/Ask/Digits/Point with SymbolInfoDouble
- Changed int ticket to ulong ticket
- Updated indicator handling (iRSI/iADX/iATR with CopyBuffer)
- Updated order placement to MqlTradeRequest/Result
- Added proper TRADE_ACTION_PENDING for stop orders
- Added OrderFillling_IOC compliance
Line 142: 'i' was declared inside for loop, not accessible outside.
Fixed by declaring 'i' before the loop:
int i=0;
for(i=0; i<logTicketsCounter; i++)
- check-syntax.sh: Pre-compilation syntax checker for MT4→MT5 issues
- metaeditor-watchdog.sh: Auto-kills stuck MetaEditor processes
- safe-compile.sh: Wrapper with 2-minute timeout for compilations
These tools help prevent the container freeze that occurred when
trying to compile OrdersEA with 100 MT4 syntax errors.
Major changes for MT5 compatibility:
- Replaced MT4 OrderSelect() with MT5 PositionGet/HistorySelect
- Replaced MarketInfo() with SymbolInfoDouble/Integer
- Replaced Bid/Ask/Digits/Point globals with function calls
- Updated trade functions to use CTrade class
- Changed ticket types from int to ulong
- Replaced WindowExpertName() with MQLInfoString()
- Replaced IsOptimization() with MQLInfoInteger()
- Updated copyright to Garfield Heron / fetcherpay.com
Note: Full grid logic needs comprehensive testing
- Removed #include WinUser32.mqh (no more MessageBox)
- web.mq4 include already disabled, removed comment
- Replaced MessageBox with Print() for margin info
- Replaced SendMailEx with SendNotificationEx using native MT4 Alert()
- Updated copyright to Garfield Heron / fetcherpay.com
- Email default set to garfield@fetcherpay.com
- Removed #include WinAPI/winuser.mqh (no more MessageBox)
- Removed #include web.mq5 (no more license check)
- Replaced MessageBox with Print() for margin info
- Replaced SendMailEx with SendNotificationEx using native MT5 notifications
- Updated copyright to Garfield Heron / fetcherpay.com
- Email default set to garfield@fetcherpay.com
- License check bypassed - always allows access
- Places multiple small trades above/below central price range
- Manages up to 600 trades in long/short arrays
- Averages price for basket exit
- Configurable HIGH/LOW range and Entry spacing
- Original file: OrdersEA (1).mq4
- ATR filter: Blocks trades when volatility < 0.5% (narrow bands)
- ADX filter: Blocks trades when trend strength < 20
- CheckVolatilityFilter() called before every trade entry
- Prevents over-trading in choppy/consolidating markets
- Both filters ON by default, configurable via inputs
- Version bumped to 1.12
- ATR filter: Blocks trades when volatility < 0.5% (narrow bands)
- ADX filter: Blocks trades when trend strength < 20
- Prevents over-trading in choppy/consolidating markets
- Both filters ON by default, can be disabled in inputs
- Version bumped to 1.12
- export-live-report.py: Export from binary deal files
- create-live-report.sh: Create report from screenshot/terminal data
- Allows creating browser-viewable reports with current live data
- Uses ,935 profit from March 21 screenshot
- export-report-html.py: Converts MT5 report to clean, styled HTML
- export-to-browser.sh: Wrapper script for easy usage
- Generates beautiful HTML report viewable in any browser
- Includes performance summary, trade stats, and risk metrics
- show-latest-report.sh: Auto-finds and displays latest MT5 report
- parse-report.py: Python parser for HTML reports with full stats
- Updated UTILS.md with documentation
- No browser needed - prevents VM crashes
- Shows account info, P&L, trade stats, performance assessment
- view-report.sh: Read HTML reports without browser
- parse-deals.py: Extract data from binary deal files
- export-history.sh: Safe export guide
- UTILS.md: Documentation for tools
Prevents VM crashes when accessing trading data.