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 copyright "Copyright 2024, Garfield Heron"
|
||||||
#property link "https://fetcherpay.com"
|
#property link "https://fetcherpay.com"
|
||||||
#property version "5.1"
|
#property version "5.2"
|
||||||
|
|
||||||
#include <Trade\Trade.mqh>
|
#include <Trade\Trade.mqh>
|
||||||
#include <Trade\PositionInfo.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_TRADES 600
|
||||||
#define MAX_LOG_TRADES 1200
|
#define MAX_LOG_TRADES 1200
|
||||||
|
|
||||||
@@ -424,7 +424,17 @@ bool CheckWeekendProtection()
|
|||||||
if(weekendCloseExecuted) weekendCloseExecuted = false;
|
if(weekendCloseExecuted) weekendCloseExecuted = false;
|
||||||
return true;
|
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)
|
if(dt.hour >= InpWeekendCloseHour)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=5.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ InpMaxWeeklyDrawdown=5.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=5.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === Session Notes ===
|
; === Session Notes ===
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ InpMaxWeeklyDrawdown=5.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === Session Notes ===
|
; === Session Notes ===
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === Session Notes ===
|
; === Session Notes ===
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ InpMaxWeeklyDrawdown=7.0
|
|||||||
|
|
||||||
; === Weekend Protection ===
|
; === Weekend Protection ===
|
||||||
InpCloseBeforeWeekend=true
|
InpCloseBeforeWeekend=true
|
||||||
InpWeekendCloseHour=17
|
InpWeekendCloseHour=7
|
||||||
InpCancelPendingBeforeWeekend=true
|
InpCancelPendingBeforeWeekend=true
|
||||||
|
|
||||||
; === EA Settings ===
|
; === EA Settings ===
|
||||||
|
|||||||
Reference in New Issue
Block a user