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>
This commit is contained in:
@@ -5,12 +5,12 @@
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Copyright 2024, Garfield Heron"
|
||||
#property link "https://fetcherpay.com"
|
||||
#property version "5.2"
|
||||
#property version "5.3"
|
||||
|
||||
#include <Trade\Trade.mqh>
|
||||
#include <Trade\PositionInfo.mqh>
|
||||
|
||||
#define VERSION "Version 5.2 Smart Grid Breakout BO MT5"
|
||||
#define VERSION "Version 5.3 Smart Grid Breakout BO MT5"
|
||||
#define MAX_TRADES 600
|
||||
#define MAX_LOG_TRADES 1200
|
||||
|
||||
@@ -114,6 +114,7 @@ input string WeekendSettings = "=== Weekend Protection ===";
|
||||
input bool InpCloseBeforeWeekend = true;
|
||||
input int InpWeekendCloseHour = 17;
|
||||
input bool InpCancelPendingBeforeWeekend = true;
|
||||
input int InpMondayStartHour = 7; // Monday: no new grids before this server hour (0 = off)
|
||||
|
||||
//--- Trade Object
|
||||
CTrade trade;
|
||||
@@ -166,6 +167,7 @@ datetime lastWeeklyScan = 0;
|
||||
|
||||
//--- Weekend Protection
|
||||
bool weekendCloseExecuted = false;
|
||||
bool mondayStandDownLogged = false;
|
||||
|
||||
//--- Master one-shot (1.4)
|
||||
bool masterShutdownDone = false;
|
||||
@@ -451,6 +453,37 @@ bool CheckWeekendProtection()
|
||||
return true;
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Monday Morning Stand-Down (5.3) |
|
||||
//| Sunday-evening ET liquidity is thin and the pivots/ATR are built |
|
||||
//| from Friday's session — skip new grids until the configured |
|
||||
//| Monday server hour. Blocking before the daily pivot recalc also |
|
||||
//| defers the ATR sample to the resume hour instead of the rollover. |
|
||||
//+------------------------------------------------------------------+
|
||||
bool CheckMondayStandDown()
|
||||
{
|
||||
if(InpMondayStartHour <= 0) return true;
|
||||
MqlDateTime dt;
|
||||
TimeToStruct(TimeCurrent(), dt);
|
||||
|
||||
if(dt.day_of_week == MONDAY && dt.hour < InpMondayStartHour)
|
||||
{
|
||||
if(!mondayStandDownLogged)
|
||||
{
|
||||
PrintS("⏸ MONDAY STAND-DOWN — no new grids before " +
|
||||
IntegerToString(InpMondayStartHour) + ":00 server");
|
||||
mondayStandDownLogged = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if(mondayStandDownLogged)
|
||||
{
|
||||
PrintS("Monday stand-down over — normal trading resumed");
|
||||
mondayStandDownLogged = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
//| Session Filter (4.1) |
|
||||
//+------------------------------------------------------------------+
|
||||
@@ -1300,6 +1333,11 @@ void OnTick()
|
||||
if(!CheckWeekendProtection())
|
||||
return;
|
||||
|
||||
// --- Monday morning stand-down (5.3) — must stay above the pivot
|
||||
// recalc so Monday's pivots/ATR are computed at the resume hour ---
|
||||
if(!CheckMondayStandDown())
|
||||
return;
|
||||
|
||||
// --- GetOut mode ---
|
||||
if(GetOut != "N" && GetOut != "n")
|
||||
{
|
||||
|
||||
@@ -52,6 +52,7 @@ InpMaxWeeklyDrawdown=5.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444012
|
||||
|
||||
@@ -52,6 +52,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444005
|
||||
|
||||
@@ -54,6 +54,7 @@ InpMaxWeeklyDrawdown=5.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444010
|
||||
|
||||
@@ -52,6 +52,7 @@ InpMaxWeeklyDrawdown=5.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444011
|
||||
|
||||
@@ -52,6 +52,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444009
|
||||
|
||||
@@ -52,6 +52,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444001
|
||||
|
||||
@@ -53,6 +53,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444004
|
||||
|
||||
@@ -52,6 +52,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444002
|
||||
|
||||
@@ -54,6 +54,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === Session Notes ===
|
||||
; BO fires on breakout of daily pivot range (ATR-scaled)
|
||||
|
||||
@@ -52,6 +52,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444006
|
||||
|
||||
@@ -55,6 +55,7 @@ InpMaxWeeklyDrawdown=5.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === Session Notes ===
|
||||
; Lower volatility = smaller moves but more frequent breakouts of ATR range
|
||||
|
||||
@@ -52,6 +52,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444007
|
||||
|
||||
@@ -53,6 +53,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444008
|
||||
|
||||
@@ -52,6 +52,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444003
|
||||
|
||||
@@ -54,6 +54,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === Session Notes ===
|
||||
; GBPJPY/XAUUSD can gap 200+ pts — BO suits them well but cut losses fast
|
||||
|
||||
@@ -53,6 +53,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444014
|
||||
|
||||
@@ -53,6 +53,7 @@ InpMaxWeeklyDrawdown=7.0
|
||||
InpCloseBeforeWeekend=true
|
||||
InpWeekendCloseHour=7
|
||||
InpCancelPendingBeforeWeekend=true
|
||||
InpMondayStartHour=7
|
||||
|
||||
; === EA Settings ===
|
||||
MagicNum=444013
|
||||
|
||||
Reference in New Issue
Block a user