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>
This commit is contained in:
@@ -5,12 +5,12 @@
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2024, Garfield Heron"
|
||||
#property link "https://fetcherpay.com"
|
||||
#property version "5.1"
|
||||
#property version "5.2"
|
||||
|
||||
#include <Trade\Trade.mqh>
|
||||
#include <Trade\PositionInfo.mqh>
|
||||
|
||||
#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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user