Compare commits

..
16 Commits
Author SHA1 Message Date
garfield 6d0c0716fa Add sync-ea-inputs: durable fix for the chart-cache persistence bug
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).
2026-08-11 01:09:34 -04:00
garfield f39464287c Close Monday start-time A/B experiment: revert B-cohort to hour=7
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.
2026-08-11 00:10:29 -04:00
garfieldandClaude Fable 5 2bde52e43b v5.7: self-heal GridHigh/GridLow if left at 0 by a restart-timing race
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>
2026-07-24 08:45:58 -04:00
garfieldandClaude Fable 5 0e2409bfcf Deploy metals sizing: XAUUSD 1.00->0.75, XAGUSD 1.00->0.35
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>
2026-07-23 01:08:45 -04:00
garfieldandClaude Fable 5 dbc6eb1671 Enable intraday range drift for metals only (XAUUSD 1500pts, XAGUSD 450pts)
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>
2026-07-22 23:40:10 -04:00
garfieldandClaude Fable 5 e72a2ea5c4 v5.6: Thursday wind-down + Friday shadow metric
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>
2026-07-17 09:43:55 -04:00
garfieldandClaude Fable 5 e2fbe0d01d Monday start-time A/B: B-cohort (GBPUSD USDJPY EURCHF AUDUSD GBPJPY EURGBP) resumes Monday at 10:00 server (3am ET / London open)
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>
2026-07-17 07:10:18 -04:00
garfieldandClaude Fable 5 342069ac98 v5.5: hourly heartbeat log line above all gates
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>
2026-07-17 00:42:40 -04:00
garfieldandClaude Fable 5 d308697fd3 v5.4: FX trail start 1000 -> 500 pts (metals keep 1000)
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>
2026-07-15 12:44:50 -04:00
garfieldandClaude Fable 5 f6120214ab XAGUSD: raise spread cap to 60pts — live silver spread (43-53) never passed the default 30, EA was permanently blocked
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 10:41:48 -04:00
garfieldandClaude Fable 5 8f60e362c5 v5.3: Monday morning stand-down until 07:00 server
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>
2026-07-11 18:18:50 -04:00
garfieldandClaude Fable 5 29baa17897 v5.2: hold weekend block all Friday + close by Thu midnight ET
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>
2026-07-11 11:57:55 -04:00
garfieldandClaude Sonnet 4.6 0175a6edff Add trailing stop to BO EA v5.1 — all 17 presets enabled
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>
2026-07-02 02:44:24 -04:00
garfieldandClaude Sonnet 4.6 bae25d07eb Scale BO EA lot sizes to 1.00 (100x original baseline)
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>
2026-06-29 09:50:58 -04:00
garfieldandClaude Sonnet 4.6 1db72f6885 Scale BO EA lot sizes 10x: 0.01 -> 0.10 across all presets
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>
2026-06-29 09:43:13 -04:00
garfieldandClaude Sonnet 4.6 3d6a0df209 Add OrdersEA_Smart_Grid_BO v5.0 — breakout EA and per-pair presets
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>
2026-06-26 13:29:49 -04:00
20 changed files with 3009 additions and 0 deletions
+1703
View File
File diff suppressed because it is too large Load Diff
+68
View File
@@ -0,0 +1,68 @@
; === OrdersEA_Smart_Grid_BO - AUDNZD ===
; Slow-moving cross — BO fires on RBA/RBNZ policy divergence
; Timeframe: H1
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=10
TP=1000
Lots=1.00
MaxLevels=3
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=22
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.2
; === Stop Loss ===
InpUseStopLoss=true
StopLoss=180
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=40
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=2.0
InpMaxWeeklyDrawdown=5.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444012
; === Session Notes ===
; Very slow pair — BO events are rare but can be strong when they occur
; Both central banks are commodity-linked; global risk-off affects both equally
+68
View File
@@ -0,0 +1,68 @@
; === OrdersEA_Smart_Grid_BO - AUDUSD ===
; Commodity-linked pair — trends on China/risk data
; Timeframe: H1
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=20
TP=2000
Lots=1.00
MaxLevels=3
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=25
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.5
; === Stop Loss ===
InpUseStopLoss=true
StopLoss=300
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=60
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444005
; === Session Notes ===
; Strong moves on RBA decisions, Chinese PMI, iron ore price swings
; Asia session active for this pair
+71
View File
@@ -0,0 +1,71 @@
; === OrdersEA_Smart_Grid_BO - EURCHF ===
; Historically low-volatility pair — BO only fires on genuine regime breaks
; Timeframe: H1
; WARNING: SNB surprise interventions can produce 500+ pt moves instantly
; BO with SL is safer than Grid for this pair during intervention events
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=10
TP=1000
Lots=1.00
MaxLevels=2
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=20
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.2
; === Stop Loss (especially important here — SNB events are catastrophic without it) ===
InpUseStopLoss=true
StopLoss=200
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=40
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=2.0
InpMaxWeeklyDrawdown=5.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444010
; === Session Notes ===
; Low daily range — BO will fire rarely, only on real breakout events
; SNB quarterly assessments: use GetOut=A before each one
; DO NOT run overnight without SL — 2015 CHF event removed 20% in seconds
+68
View File
@@ -0,0 +1,68 @@
; === OrdersEA_Smart_Grid_BO - EURGBP ===
; Low-range pair except on UK/EU political divergence events
; Timeframe: H1
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=10
TP=1000
Lots=1.00
MaxLevels=3
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=22
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.2
; === Stop Loss ===
InpUseStopLoss=true
StopLoss=200
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=40
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=2.0
InpMaxWeeklyDrawdown=5.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444011
; === Session Notes ===
; Best BO opportunities: UK/EU trade data, BOE vs ECB policy divergence
; Generally quiet — expect infrequent fills
+68
View File
@@ -0,0 +1,68 @@
; === OrdersEA_Smart_Grid_BO - EURJPY ===
; Risk proxy pair — trends sharply on risk sentiment shifts
; Timeframe: H1
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=25
TP=2000
Lots=1.00
MaxLevels=3
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=25
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.7
; === Stop Loss ===
InpUseStopLoss=true
StopLoss=400
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=70
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444009
; === Session Notes ===
; Strong during European session when risk appetite shifts
; BOJ intervention risk — monitor JPY pairs across the board
+68
View File
@@ -0,0 +1,68 @@
; === OrdersEA_Smart_Grid_BO - EURUSD ===
; Most liquid pair, tight spreads, clean technical moves
; Timeframe: H1
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=20
TP=2000
Lots=1.00
MaxLevels=3
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=25
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.5
; === Stop Loss ===
InpUseStopLoss=true
StopLoss=300
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=60
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444001
; === Session Notes ===
; Best BO windows: London open (07:00 GMT), NY open (13:30 GMT)
; Avoid: ECB press conferences, NFP first 5 min (too much noise)
+70
View File
@@ -0,0 +1,70 @@
; === OrdersEA_Smart_Grid_BO - GBPJPY ===
; "The Beast" — extreme volatility, excellent breakout pair
; Timeframe: H1
; WARNING: 200+ pt moves common; SL is non-negotiable
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=50
TP=5000
Lots=1.00
MaxLevels=2
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=28
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=2.2
; === Stop Loss (MANDATORY — GBPJPY has no mercy on unprotected positions) ===
InpUseStopLoss=true
StopLoss=800
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=120
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=true
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444004
; === Session Notes ===
; GBPJPY BO targets: London open, US session risk events
; Avoid: BOJ + BOE same-day events (whipsaw kills BO fills)
; Reduce Lots to 0.01 and monitor first 2 weeks closely
+68
View File
@@ -0,0 +1,68 @@
; === OrdersEA_Smart_Grid_BO - GBPUSD ===
; Higher volatility than EURUSD — wider entry and SL
; Timeframe: H1
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=25
TP=2500
Lots=1.00
MaxLevels=3
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=25
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.6
; === Stop Loss ===
InpUseStopLoss=true
StopLoss=350
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=70
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444002
; === Session Notes ===
; Cable breaks hard on UK data, BOE announcements
; Avoid BoE rate decision days unless watching live
+69
View File
@@ -0,0 +1,69 @@
; === OrdersEA_Smart_Grid_BO - Major Pairs Template ===
; Strategy: Breakout — buy above resistance, sell below support
; Best for: EURUSD, GBPUSD, AUDUSD, USDJPY
; Timeframe: H1
; Activates when ADX > 25 (trending) and price breaks grid boundary
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=20
TP=2000
Lots=1.00
MaxLevels=3
; === Range Filters (inverted logic in BO: low ADXMax = quick trend detection) ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=25
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.5
; === Stop Loss (mandatory for breakout) ===
InpUseStopLoss=true
StopLoss=300
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=60
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === Session Notes ===
; BO fires on breakout of daily pivot range (ATR-scaled)
; Best: London open (07:00-09:00 GMT), NY open (13:30-15:00 GMT)
; Avoid: Low-volume overnight sessions (Asia)
; SL should be below GridHigh for buys, above GridLow for sells
+68
View File
@@ -0,0 +1,68 @@
; === OrdersEA_Smart_Grid_BO - NZDUSD ===
; Similar to AUDUSD, slightly lower volatility
; Timeframe: H1
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=20
TP=2000
Lots=1.00
MaxLevels=3
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=25
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.4
; === Stop Loss ===
InpUseStopLoss=true
StopLoss=280
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=55
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444006
; === Session Notes ===
; RBNZ decisions can cause strong BO moves
; Lower daily range than AUDUSD — expect fewer fills
+68
View File
@@ -0,0 +1,68 @@
; === OrdersEA_Smart_Grid_BO - Steady/Low-Vol Pairs Template ===
; Strategy: Breakout — buy above resistance, sell below support
; Best for: EURCHF, EURGBP, AUDNZD
; Timeframe: H1
; These pairs trend less — lower ADXMax catches moderate trends early
; WARNING: EURCHF carries SNB intervention risk (see pair notes below)
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=10
TP=1000
Lots=1.00
MaxLevels=3
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=22
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.2
; === Stop Loss (mandatory) ===
InpUseStopLoss=true
StopLoss=200
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=40
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=2.0
InpMaxWeeklyDrawdown=5.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === Session Notes ===
; Lower volatility = smaller moves but more frequent breakouts of ATR range
; Tight SL important — false breakouts common on these pairs
+68
View File
@@ -0,0 +1,68 @@
; === OrdersEA_Smart_Grid_BO - USDCAD ===
; Oil-correlated pair — trends strongly on WTI moves and BOC events
; Timeframe: H1
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=20
TP=2000
Lots=1.00
MaxLevels=3
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=25
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.5
; === Stop Loss ===
InpUseStopLoss=true
StopLoss=300
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=60
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444007
; === Session Notes ===
; Watch WTI crude oil price — USDCAD is inversely correlated
; BOC rate announcements produce clean BO moves
+69
View File
@@ -0,0 +1,69 @@
; === OrdersEA_Smart_Grid_BO - USDCHF ===
; Safe-haven pair — breakouts on risk-off events
; Timeframe: H1
; NOTE: Inversely correlated with EURUSD — avoid running both long/short simultaneously
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=20
TP=2000
Lots=1.00
MaxLevels=3
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=25
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.4
; === Stop Loss ===
InpUseStopLoss=true
StopLoss=280
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=55
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444008
; === Session Notes ===
; SNB intervention risk — USDCHF can gap on SNB surprise moves
; Safe-haven demand spikes on geopolitical events
+68
View File
@@ -0,0 +1,68 @@
; === OrdersEA_Smart_Grid_BO - USDJPY ===
; Risk-on/risk-off pair — strong trending behaviour on macro events
; Timeframe: H1
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=20
TP=2000
Lots=1.00
MaxLevels=3
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=25
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=1.5
; === Stop Loss ===
InpUseStopLoss=true
StopLoss=300
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=60
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=false
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444003
; === Session Notes ===
; BOJ intervention risk — USDJPY can gap 200+ pts on intervention
; Watch for BOJ announcements; use GetOut=A if intervention suspected
+68
View File
@@ -0,0 +1,68 @@
; === OrdersEA_Smart_Grid_BO - Volatile Pairs Template ===
; Strategy: Breakout — buy above resistance, sell below support
; Best for: GBPJPY, XAUUSD, GBPUSD (high volatility)
; Timeframe: H1
; WARNING: Large moves — SL is critical, size down
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=50
TP=5000
Lots=1.00
MaxLevels=2
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=28
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=2.0
; === Stop Loss (mandatory) ===
InpUseStopLoss=true
StopLoss=800
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=500
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=100
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=true
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === Session Notes ===
; GBPJPY/XAUUSD can gap 200+ pts — BO suits them well but cut losses fast
; Monitor DiagnosticMode output on first few trades
; Consider halving Lots on first live session
+82
View File
@@ -0,0 +1,82 @@
; === OrdersEA_Smart_Grid_BO - XAGUSD (Silver) ===
; More volatile than Gold per pip — high leverage, high reward breakouts
; Timeframe: H1
; WARNING: Silver can move 3-4x the range of Gold in percentage terms
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=60
TP=3000
Lots=0.35
MaxLevels=2
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=28
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=2.2
; === Spread Filter ===
; Silver's live spread runs 43-53pts on MetaQuotes-Demo — the EA default
; of 30 blocked every cycle. 60 clears normal spread, still blocks blowouts.
InpMaxSpreadPoints=60
; === Range Drift ===
; Same issue as gold — stale daily band left silver sell-only and unfilled
; all week. Re-center intraday once price drifts ~1x hourly ATR from the
; band's midpoint (silver ATR ~0.4-0.5 -> ~400-500pts at 0.001 point size).
InpRangeDriftEnable=true
InpMoveRangeTrigger=450
; === Stop Loss (MANDATORY) ===
InpUseStopLoss=true
StopLoss=1000
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=1000
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=150
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=true
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444014
; === Session Notes ===
; Silver correlates with Gold but amplifies moves
; Wider spreads than Gold — Entry=60 ensures we're past the spread cost
; Reduce Lots further if running alongside XAUUSD (correlated exposure)
+81
View File
@@ -0,0 +1,81 @@
; === OrdersEA_Smart_Grid_BO - XAUUSD (Gold) ===
; Strongest trending instrument — excellent BO candidate on macro events
; Timeframe: H1
; WARNING: 500+ pt moves on FOMC, NFP, geopolitical shocks — SL is critical
; === Grid / BO Settings ===
UseAutoPivots=true
InpManualHigh=0
InpManualLow=0
Entry=100
TP=5000
Lots=0.75
MaxLevels=2
; === Range Filters ===
UseRSIFilter=false
RSIPeriod=14
RSILower=40
RSIUpper=60
UseADXFilter=true
ADXPeriod=14
ADXMax=30
UseATRFilter=true
ATRPeriod=14
ATRMultiplier=2.5
; === Range Drift ===
; Daily pivot band only refreshes once per server day. Gold spent all of
; Jul 20-22 sitting above that stale band (no fresh buy-stop could be
; placed — no-trade-zone guard correctly refused one too close to price),
; so the sell-side-only grid kept getting cancelled/re-placed without a
; fill. Re-center intraday once price drifts ~1x hourly ATR from the
; band's midpoint so both sides stay reachable.
InpRangeDriftEnable=true
InpMoveRangeTrigger=1500
; === Stop Loss (MANDATORY — Gold can wipe 500 pts without SL) ===
InpUseStopLoss=true
StopLoss=1500
; === Trailing Stop ===
InpUseTrailingStop=true
InpTrailStartPoints=1000
InpTrailStop=500
; === Risk Management ===
TRADE_RANGE=200
LongLimit=0
ShortLimit=0
GetOut=N
OpenNewTrades=Y
TakeProfitLevelPercent=0
TakeProfitLevelDollarAmount=0
EquityFactorPercent=0
LotsFactorPercent=0
BaseEquity=10000
Master=false
DiagnosticModeOn=true
InpMaxDailyDrawdown=3.0
InpMaxWeeklyDrawdown=7.0
; === Weekend Protection ===
InpCloseBeforeWeekend=true
InpWeekendCloseHour=7
InpCancelPendingBeforeWeekend=true
InpMondayStartHour=7
; === Thursday Wind-Down ===
InpUseWinddown=true
InpWinddownStartHour=19
InpWinddownTrailStart=200
InpWinddownTrailStop=150
; === EA Settings ===
MagicNum=444013
; === Session Notes ===
; Best BO events: FOMC decisions, NFP, geopolitical escalation, CPI surprises
; Gold trends very cleanly once ADX > 30
; ADXMax=30 set higher than other pairs — Gold needs confirmed trend before BO fires
; Avoid thin Asian overnight sessions for BO entry
+107
View File
@@ -0,0 +1,107 @@
#!/usr/bin/env python3
"""Syncs authoritative bo-*.set preset values into MT5's actual live-session
cache files (MQL5/Profiles/Charts/Default/chartNN.chr).
Root cause (found 2026-08-10): MT5's "save chart state on graceful exit"
never actually fires under this Wine/container setup -- chartNN.chr files
were found frozen at their 2026-08-06 23:26 mtimes despite many later
restarts, including ones using the documented `stop_grace_period: 60s` +
`docker compose down` "graceful" path. Every restart since Aug 6 silently
reloads that one frozen snapshot, which is why a live GUI input edit
(Properties/F7 -> OK) reverts after the next restart no matter how
"gracefully" the container is stopped. This hit the XAUUSD spread filter
(Jul 30, Aug 6/7) and the Monday A/B reversion (Aug 10) alike -- general,
not symbol-specific.
Fix: don't rely on MT5 ever writing this file correctly. Treat the
bo-*.set files (repo + Presets/) as the single source of truth and write
them directly into chartNN.chr ourselves, every boot. chartNN.chr uses
the exact same `Key=Value` input names as the .set files (verified), just
UTF-16LE with a BOM and CRLF instead of the .set files' UTF-8/LF -- and
one chart file per open chart, auto-mapped here via each file's own
`symbol=` line rather than a hardcoded chart-number list, so this keeps
working if charts are ever reordered.
Idempotent -- safe to run any time, not just at boot.
"""
import glob
import os
import re
import sys
PRESETS_DIR = "/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Presets"
CHARTS_DIR = "/config/.wine/drive_c/Program Files/MetaTrader 5/MQL5/Profiles/Charts/Default"
BOM = b"\xff\xfe"
def load_preset(path):
values = {}
with open(path, "r", encoding="utf-8", errors="ignore") as f:
for line in f:
line = line.strip("\r\n")
if not line or line.startswith(";") or line.startswith("#"):
continue
if "=" not in line:
continue
key, _, value = line.partition("=")
values[key] = value
return values
def sync_chart(chart_path):
with open(chart_path, "rb") as f:
raw = f.read()
if not raw.startswith(BOM):
return None, "no UTF-16LE BOM, skipping"
text = raw[len(BOM):].decode("utf-16-le", errors="replace")
m = re.search(r"^symbol=(\S+)\r?$", text, re.MULTILINE)
if not m:
return None, "no symbol= line found"
symbol = m.group(1)
preset_path = os.path.join(PRESETS_DIR, f"bo-{symbol.lower()}.set")
if not os.path.isfile(preset_path):
return symbol, f"no matching preset {preset_path}"
preset_values = load_preset(preset_path)
lines = text.split("\n")
changed = 0
for i, line in enumerate(lines):
body = line[:-1] if line.endswith("\r") else line
if "=" not in body:
continue
key, _, current_value = body.partition("=")
if key in preset_values and preset_values[key] != current_value:
lines[i] = f"{key}={preset_values[key]}\r"
changed += 1
if changed:
new_text = "\n".join(lines)
new_raw = BOM + new_text.encode("utf-16-le")
tmp_path = chart_path + ".tmp"
with open(tmp_path, "wb") as f:
f.write(new_raw)
os.replace(tmp_path, chart_path)
return symbol, f"{changed} value(s) synced from {os.path.basename(preset_path)}"
def main():
if not os.path.isdir(CHARTS_DIR):
print(f"No charts dir at {CHARTS_DIR} -- nothing to sync yet.")
return 0
for chart_path in sorted(glob.glob(os.path.join(CHARTS_DIR, "chart*.chr"))):
symbol, msg = sync_chart(chart_path)
label = f"[{symbol}]" if symbol else ""
print(f" {os.path.basename(chart_path)} {label}: {msg}")
return 0
if __name__ == "__main__":
sys.exit(main())
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
# Thin wrapper: the linuxserver.io custom-cont-init.d runner invokes every
# executable file directly in this directory via `sh`, ignoring shebangs,
# so a plain .py file placed here fails outright when picked up on its
# own. The real logic lives in lib/ (a subdirectory, which the runner
# does not recurse into) and is invoked explicitly via python3 here.
# Runs on every container start (before MT5 itself, per the s6 cont-init
# ordering) -- see lib/sync-ea-inputs.py for what it does and why.
python3 "$(dirname "$0")/lib/sync-ea-inputs.py"