From 24f3d09c96dd706b26e6bc33e5b8aafeedf50b59 Mon Sep 17 00:00:00 2001 From: Garfield Date: Sun, 29 Mar 2026 23:59:13 -0400 Subject: [PATCH] Fix: make gridPlaced global so CheckWeekendProtection can access it --- OrdersEA_Smart_Grid.mq5 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OrdersEA_Smart_Grid.mq5 b/OrdersEA_Smart_Grid.mq5 index 5672e24..fd8e275 100644 --- a/OrdersEA_Smart_Grid.mq5 +++ b/OrdersEA_Smart_Grid.mq5 @@ -132,6 +132,9 @@ datetime lastEquityReset = 0; bool weekendCloseExecuted = false; datetime lastWeekendCheck = 0; +//--- Grid State +static bool gridPlaced = false; + //+------------------------------------------------------------------+ //| Check Daily Drawdown Protection | //+------------------------------------------------------------------+ @@ -657,10 +660,9 @@ bool IsBreakout() //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() - { - static datetime lastBarTime = 0; - static bool gridPlaced = false; - datetime currentBarTime = iTime(_Symbol, PERIOD_CURRENT, 0); + { + static datetime lastBarTime = 0; + datetime currentBarTime = iTime(_Symbol, PERIOD_CURRENT, 0); MqlDateTime dt; TimeToStruct(TimeCurrent(), dt);