From 29baa178972a14251522d779301f97610211621c Mon Sep 17 00:00:00 2001 From: Garfield Date: Sat, 11 Jul 2026 11:57:55 -0400 Subject: [PATCH] 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 --- OrdersEA_Smart_Grid_BO.mq5 | 16 +++++++++++++--- bo-audnzd.set | 2 +- bo-audusd.set | 2 +- bo-eurchf.set | 2 +- bo-eurgbp.set | 2 +- bo-eurjpy.set | 2 +- bo-eurusd.set | 2 +- bo-gbpjpy.set | 2 +- bo-gbpusd.set | 2 +- bo-major.set | 2 +- bo-nzdusd.set | 2 +- bo-steady.set | 2 +- bo-usdcad.set | 2 +- bo-usdchf.set | 2 +- bo-usdjpy.set | 2 +- bo-volatile.set | 2 +- bo-xagusd.set | 2 +- bo-xauusd.set | 2 +- 18 files changed, 30 insertions(+), 20 deletions(-) diff --git a/OrdersEA_Smart_Grid_BO.mq5 b/OrdersEA_Smart_Grid_BO.mq5 index 752284f..4c3400b 100755 --- a/OrdersEA_Smart_Grid_BO.mq5 +++ b/OrdersEA_Smart_Grid_BO.mq5 @@ -5,12 +5,12 @@ //+------------------------------------------------------------------+ #property copyright "Copyright 2024, Garfield Heron" #property link "https://fetcherpay.com" -#property version "5.1" +#property version "5.2" #include #include -#define VERSION "Version 5.1 Smart Grid Breakout BO MT5" +#define VERSION "Version 5.2 Smart Grid Breakout BO MT5" #define MAX_TRADES 600 #define MAX_LOG_TRADES 1200 @@ -424,7 +424,17 @@ bool CheckWeekendProtection() if(weekendCloseExecuted) weekendCloseExecuted = false; return true; } - if(weekendCloseExecuted) return true; + // Once the weekend close has run, stay blocked for the rest of Friday — + // no new grids until the next trading day. Keep sweeping in case a + // close/cancel failed on the first attempt (both helpers are silent no-ops + // when there is nothing left to do). + if(weekendCloseExecuted) + { + CloseAllPositions("Weekend protection retry"); + if(InpCancelPendingBeforeWeekend) + CancelAllOrders("Weekend protection retry"); + return false; + } if(dt.hour >= InpWeekendCloseHour) { diff --git a/bo-audnzd.set b/bo-audnzd.set index ddbb6e0..50a2387 100644 --- a/bo-audnzd.set +++ b/bo-audnzd.set @@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=5.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-audusd.set b/bo-audusd.set index 5cd82b9..62a7774 100644 --- a/bo-audusd.set +++ b/bo-audusd.set @@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-eurchf.set b/bo-eurchf.set index 0f4c97c..b81d51b 100644 --- a/bo-eurchf.set +++ b/bo-eurchf.set @@ -52,7 +52,7 @@ InpMaxWeeklyDrawdown=5.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-eurgbp.set b/bo-eurgbp.set index 7b16695..9dd9477 100644 --- a/bo-eurgbp.set +++ b/bo-eurgbp.set @@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=5.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-eurjpy.set b/bo-eurjpy.set index d23dbaa..0c78d56 100644 --- a/bo-eurjpy.set +++ b/bo-eurjpy.set @@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-eurusd.set b/bo-eurusd.set index 18f30cf..05962f7 100644 --- a/bo-eurusd.set +++ b/bo-eurusd.set @@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-gbpjpy.set b/bo-gbpjpy.set index 031a687..992d50d 100644 --- a/bo-gbpjpy.set +++ b/bo-gbpjpy.set @@ -51,7 +51,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-gbpusd.set b/bo-gbpusd.set index de99c41..9d5f133 100644 --- a/bo-gbpusd.set +++ b/bo-gbpusd.set @@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-major.set b/bo-major.set index 7bc5b82..ae3431e 100644 --- a/bo-major.set +++ b/bo-major.set @@ -52,7 +52,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === Session Notes === diff --git a/bo-nzdusd.set b/bo-nzdusd.set index 6e99dc7..061ebbe 100644 --- a/bo-nzdusd.set +++ b/bo-nzdusd.set @@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-steady.set b/bo-steady.set index b10dd95..d3a9128 100644 --- a/bo-steady.set +++ b/bo-steady.set @@ -53,7 +53,7 @@ InpMaxWeeklyDrawdown=5.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === Session Notes === diff --git a/bo-usdcad.set b/bo-usdcad.set index fc0f59e..3866ba4 100644 --- a/bo-usdcad.set +++ b/bo-usdcad.set @@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-usdchf.set b/bo-usdchf.set index a1bd835..0082a8c 100644 --- a/bo-usdchf.set +++ b/bo-usdchf.set @@ -51,7 +51,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-usdjpy.set b/bo-usdjpy.set index 0898179..eb1eb5c 100644 --- a/bo-usdjpy.set +++ b/bo-usdjpy.set @@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-volatile.set b/bo-volatile.set index 7420dab..ee011ed 100644 --- a/bo-volatile.set +++ b/bo-volatile.set @@ -52,7 +52,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === Session Notes === diff --git a/bo-xagusd.set b/bo-xagusd.set index 2296254..ca92fff 100644 --- a/bo-xagusd.set +++ b/bo-xagusd.set @@ -51,7 +51,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings === diff --git a/bo-xauusd.set b/bo-xauusd.set index 6ddda5e..a387be1 100644 --- a/bo-xauusd.set +++ b/bo-xauusd.set @@ -51,7 +51,7 @@ InpMaxWeeklyDrawdown=7.0 ; === Weekend Protection === InpCloseBeforeWeekend=true -InpWeekendCloseHour=17 +InpWeekendCloseHour=7 InpCancelPendingBeforeWeekend=true ; === EA Settings ===