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")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user