Page 2 of 4

Re: Golden Week and Thanksgiving: Holiday-Specific Liquidity Patterns

Posted: Wed Oct 07, 2026 6:35 pm
by PTScalper
TradingView has a fundamental technical limitation: it does not store historical Bid/Ask data, making it impossible to directly call historical spread values for backtesting or visual filtering. However, when liquidity providers pull their orders and spreads widen drastically, it leaves a distinct mathematical footprint on the price action.

We can detect this footprint in real-time by tracking Micro-Gaps (which occur during the 5:00 PM EST rollover spread blowout) and Anomalous Wick-to-Body Ratios (whipsaws caused by thin liquidity).

Re: Golden Week and Thanksgiving: Holiday-Specific Liquidity Patterns

Posted: Wed Oct 07, 2026 6:35 pm
by PTScalper
Here is the fully modified script integrating a dynamic spread proxy filter. By tying the gap and wick thresholds directly to the ATR, the script automatically adapts to the currency pair without needing manual pip conversions.

Code: Select all

//@version=5
indicator("Holiday, Volatility & Spread Danger Zones", overlay=true)

// =============================================================================
// INPUTS & TOGGLES
// =============================================================================
grp_holidays = "Calendar Holiday Filters"
showXmasNY   = input.bool(true, title="Christmas to New Year (Dec 24 - Jan 2)", group=grp_holidays)
showGolden   = input.bool(true, title="Japanese Golden Week (Apr 29 - May 5)", group=grp_holidays)
showUSThanks = input.bool(true, title="US Thanksgiving & Friday", group=grp_holidays)
showAugust   = input.bool(false, title="August Summer Drain", group=grp_holidays)

grp_vol = "Dynamic Volatility Filter"
useVolFilter  = input.bool(true, title="Enable Dynamic Vol Filter", group=grp_vol)
atrLen        = input.int(14, title="ATR Length", group=grp_vol)
baselineLen   = input.int(100, title="Baseline Length (SMA of ATR)", group=grp_vol)
dropThreshold = input.float(70.0, title="Vol Drop Threshold (%)", tooltip="Flags dead zone if ATR drops below this % of baseline.", group=grp_vol)

grp_spread = "Spread Widening Proxy (Gaps & Whipsaws)"
useSpreadFilter = input.bool(true, title="Enable Spread Widening Proxy", group=grp_spread)
gapAtrPercent   = input.float(15.0, title="Max Allowed Gap (% of ATR)", tooltip="Flags if the gap between close[1] and open[0] exceeds this % of ATR. Catches rollover spread spikes.", group=grp_spread)
bodyMaxPercent  = input.float(25.0, title="Max Body Size (% of Total Candle)", tooltip="Flags if the candle is large (above ATR) but mostly wicks. Catches thin liquidity sweeps.", group=grp_spread)

// =============================================================================
// CALENDAR LOGIC
// =============================================================================
isXmasNY = showXmasNY and ((month == 12 and dayofmonth >= 24) or (month == 1 and dayofmonth <= 2))
isGoldenWeek = showGolden and ((month == 4 and dayofmonth >= 29) or (month == 5 and dayofmonth <= 5))
isThanksgiving = (month == 11 and dayofweek == dayofweek.thursday and dayofmonth >= 22 and dayofmonth <= 28)
isBlackFriday  = (month == 11 and dayofweek == dayofweek.friday and dayofmonth >= 23 and dayofmonth <= 29)
isUSHoliday    = showUSThanks and (isThanksgiving or isBlackFriday)
isAugust = showAugust and (month == 8)

// =============================================================================
// DYNAMIC VOLATILITY LOGIC
// =============================================================================
currentAtr = ta.atr(atrLen)
baselineAtr = ta.sma(currentAtr, baselineLen)
isVolDead = useVolFilter and (currentAtr < (baselineAtr * (dropThreshold / 100)))

// =============================================================================
// SPREAD WIDENING PROXY LOGIC
// =============================================================================
// 1. Micro-Gap Detection (Catches 5:00 PM rollover and news spread spikes)
gapSize = math.abs(open - close[1])
isGapSpike = useSpreadFilter and (gapSize > (currentAtr * (gapAtrPercent / 100)))

// 2. Whipsaw Detection (Catches liquidity sweeps where price jumps wildly but fails to sustain)
candleRange = high - low
candleBody = math.abs(close - open)
// Only flag if the candle range is significant (> 80% of ATR) AND the body is tiny relative to the wicks
isWickSpike = useSpreadFilter and (candleRange > (currentAtr * 0.8)) and (candleBody < (candleRange * (bodyMaxPercent / 100)))

isSpreadSpike = isGapSpike or isWickSpike

// Master Strategy Filter
isDangerZone = isXmasNY or isGoldenWeek or isUSHoliday or isAugust or isVolDead or isSpreadSpike

// =============================================================================
// VISUALIZATION
// =============================================================================
colorXmas   = color.new(color.red, 85)
colorGolden = color.new(color.orange, 85)
colorUS     = color.new(color.blue, 85)
colorAug    = color.new(color.purple, 90)
colorVol    = color.new(color.gray, 80)
colorSpread = color.new(color.yellow, 70)

// Hierarchical Background Painting (Calendar -> Volatility -> Spread)
isHolidayActive = isXmasNY or isGoldenWeek or isUSHoliday or isAugust

bgcolor(isXmasNY ? colorXmas : na, title="Christmas/NY BG")
bgcolor(isGoldenWeek ? colorGolden : na, title="Golden Week BG")
bgcolor(isUSHoliday ? colorUS : na, title="US Thanksgiving BG")
bgcolor(isAugust ? colorAug : na, title="August BG")

bgcolor((isVolDead and not isHolidayActive) ? colorVol : na, title="Low Volatility BG")
bgcolor((isSpreadSpike and not isVolDead and not isHolidayActive) ? colorSpread : na, title="Spread Spike BG")

// Bottom marker for strategy integration
plotshape(isDangerZone, title="Danger Zone Active", style=shape.xcross, location=location.bottom, color=color.new(color.red, 50), size=size.tiny)

Re: Golden Week and Thanksgiving: Holiday-Specific Liquidity Patterns

Posted: Wed Oct 07, 2026 6:35 pm
by PTScalper
The Microstructure Mechanics

Micro-Gap Detection (gapAtrPercent): In major forex pairs, price is supposed to be a continuous stream. If a 15-minute candle closes and the very next candle opens at a drastically different price, a massive spread blowout has occurred. By setting the threshold to 15% of the current ATR, the script automatically flags the daily 5:00 PM EST rollover gap or sudden pre-news liquidity vacuums.

Whipsaw Detection (bodyMaxPercent): When Tier-1 banks pull their limit orders, market orders rip through the thin book, creating massive wicks. The script calculates the total range of the candle (high - low). If that range is significant (close to the ATR) but the actual body makes up less than 25% of that range, it flags the bar yellow. This prevents your automated system from firing a breakout trade during a localized liquidity sweep.

Hierarchical Visualization: The background colors are coded so they do not bleed into each other. Calendar holidays override everything (Red/Blue/Orange). If no holiday is active, a dead volatility zone paints Gray. If volatility is normal but a sudden spread spike occurs, it flashes Yellow.

Would you like to wire this indicator into TradingView's built-in alert system so it can send a webhook to pause a trading bot when isDangerZone turns true?

Re: Golden Week and Thanksgiving: Holiday-Specific Liquidity Patterns

Posted: Wed Oct 07, 2026 6:37 pm
by PTScalper
Here is the direct translation to MQL4 for MetaTrader 4.

Because MT4 handles charting differently than TradingView, this script introduces a few necessary architectural adjustments:

Background Scaling: Drawing standard rectangles in the main MT4 window breaks the vertical price scale. To replicate Pine Script's bgcolor, this script generates thick, background-layered Vertical Lines (OBJ_VLINE) that paint the zone without squashing your chart.

Buffer Arrays: Calculating an SMA of an ATR requires a hidden buffer (AtrBuffer) that stores the raw ATR values before iMAOnArray calculates the baseline.

Time Series Indexing: In MQL4, is the current candle and [i+1] is the older historical candle (the exact opposite of Pine Script).

Re: Golden Week and Thanksgiving: Holiday-Specific Liquidity Patterns

Posted: Wed Oct 07, 2026 6:38 pm
by PTScalper
MQL4 version: 1.01

Code: Select all

//+------------------------------------------------------------------+
//|                                  HolidayDangerZones_Overlay.mq4  |
//+------------------------------------------------------------------+
#property copyright "Generated for MT4"
#property version   "1.00"
#property strict
#property indicator_chart_window

// We use 2 buffers: one for the cross markers, one hidden for the ATR
#property indicator_buffers 2
#property indicator_color1 clrRed
#property indicator_color2 clrNONE 

// =============================================================================
// INPUTS & TOGGLES
// =============================================================================
input string   grp1 = "--- Calendar Holiday Filters ---";
input bool     ShowXmasNY      = true;      // Christmas to New Year
input bool     ShowGolden      = true;      // Japanese Golden Week
input bool     ShowUSThanks    = true;      // US Thanksgiving & Friday
input bool     ShowAugust      = false;     // August Summer Drain

input string   grp2 = "--- Dynamic Volatility Filter ---";
input bool     UseVolFilter    = true;      // Enable Dynamic Vol Filter
input int      AtrLen          = 14;        // ATR Length
input int      BaselineLen     = 100;       // Baseline Length (SMA of ATR)
input double   DropThreshold   = 70.0;      // Vol Drop Threshold (%)

input string   grp3 = "--- Spread Widening Proxy ---";
input bool     UseSpreadFilter = true;      // Enable Spread Proxy
input double   GapAtrPercent   = 15.0;      // Max Allowed Gap (% of ATR)
input double   BodyMaxPercent  = 25.0;      // Max Body Size (% of Total Candle)

input string   grp4 = "--- Visualization Colors ---";
input color    ColorXmas       = clrRed;
input color    ColorGolden     = clrOrange;
input color    ColorUS         = clrBlue;
input color    ColorAug        = clrPurple;
input color    ColorVol        = clrSilver;
input color    ColorSpread     = clrYellow;

// Buffers
double DangerMarker[];
double AtrBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit() {
    // Setup Danger Marker (Cross below the candle)
    SetIndexBuffer(0, DangerMarker);
    SetIndexStyle(0, DRAW_ARROW);
    SetIndexArrow(0, 133); // Small cross symbol in MT4 Wingdings
    SetIndexLabel(0, "Danger Zone Active");

    // Setup Hidden ATR Buffer for SMA calculations
    SetIndexBuffer(1, AtrBuffer);
    SetIndexStyle(1, DRAW_NONE); 

    // Clean up any old background lines from previous sessions
    ObjectsDeleteAll(0, "DZ_VLine_");
    
    return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {
    ObjectsDeleteAll(0, "DZ_VLine_");
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[]) {
    
    // Not enough data to calculate baseline
    if(rates_total < BaselineLen) return(0);
    
    int limit = rates_total - prev_calculated;
    if(prev_calculated > 0) limit++; // Recalculate current bar on ticks
    else limit = rates_total - 2;    // Initial run (skip oldest to avoid index out of bounds)

    // Pass 1: Populate the ATR Buffer first so iMAOnArray has data to read
    for(int i = limit; i >= 0; i--) {
        AtrBuffer[i] = iATR(NULL, 0, AtrLen, i);
    }
    
    // Pass 2: Main Microstructure Logic
    for(int i = limit; i >= 0; i--) {
        double currentAtr = AtrBuffer[i];
        // Calculate the rolling SMA of the ATR
        double baselineAtr = iMAOnArray(AtrBuffer, rates_total, BaselineLen, 0, MODE_SMA, i);
        
        datetime t = time[i];
        int m = TimeMonth(t);
        int d = TimeDay(t);
        int dow = TimeDayOfWeek(t);
        
        // 1. Calendar Logic
        bool isXmasNY = ShowXmasNY && ((m == 12 && d >= 24) || (m == 1 && d <= 2));
        bool isGoldenWeek = ShowGolden && ((m == 4 && d >= 29) || (m == 5 && d <= 5));
        
        // Thanksgiving dynamically catches the 4th Thursday and following Friday
        bool isThanksgiving = (m == 11 && dow == 4 && d >= 22 && d <= 28);
        bool isBlackFriday  = (m == 11 && dow == 5 && d >= 23 && d <= 29);
        bool isUSHoliday = ShowUSThanks && (isThanksgiving || isBlackFriday);
        
        bool isAugust = ShowAugust && (m == 8);
        
        // 2. Dynamic Volatility Logic
        bool isVolDead = UseVolFilter && (currentAtr < (baselineAtr * (DropThreshold / 100.0)));
        
        // 3. Spread Widening Proxy Logic (Gaps & Whipsaws)
        // Ensure we don't look past the oldest available candle
        double prevClose = (i + 1 < rates_total) ? close[i+1] : open[i];
        double gapSize = MathAbs(open[i] - prevClose);
        bool isGapSpike = UseSpreadFilter && (gapSize > (currentAtr * (GapAtrPercent / 100.0)));
        
        double candleRange = high[i] - low[i];
        double candleBody = MathAbs(close[i] - open[i]);
        bool isWickSpike = UseSpreadFilter && (candleRange > (currentAtr * 0.8)) && (candleBody < (candleRange * (BodyMaxPercent / 100.0)));
        
        bool isSpreadSpike = isGapSpike || isWickSpike;
        
        // Master Filter Boolean
        bool isDangerZone = isXmasNY || isGoldenWeek || isUSHoliday || isAugust || isVolDead || isSpreadSpike;
        
        // Unique object name tied to the exact candle time
        string objName = "DZ_VLine_" + IntegerToString(t);
        
        if(isDangerZone) {
            // Plot the strategy cross just below the candle low
            DangerMarker[i] = low[i] - (currentAtr * 0.5);
            
            // Determine Background Color Hierarchy
            color bgColor = clrNONE;
            if(isXmasNY) bgColor = ColorXmas;
            else if(isGoldenWeek) bgColor = ColorGolden;
            else if(isUSHoliday) bgColor = ColorUS;
            else if(isAugust) bgColor = ColorAug;
            else if(isVolDead) bgColor = ColorVol;
            else if(isSpreadSpike) bgColor = ColorSpread;
            
            // Draw or update the background vertical line
            if(ObjectFind(0, objName) < 0) {
                ObjectCreate(0, objName, OBJ_VLINE, 0, t, 0);
                ObjectSetInteger(0, objName, OBJPROP_COLOR, bgColor);
                ObjectSetInteger(0, objName, OBJPROP_BACK, true);    // Push behind candles
                ObjectSetInteger(0, objName, OBJPROP_WIDTH, 5);      // Width 5 creates the background block
                ObjectSetInteger(0, objName, OBJPROP_STYLE, STYLE_SOLID);
                ObjectSetInteger(0, objName, OBJPROP_SELECTABLE, false);
                ObjectSetInteger(0, objName, OBJPROP_HIDDEN, true);  // Hide from Object List
            } else {
                ObjectSetInteger(0, objName, OBJPROP_COLOR, bgColor); // Update if color priority shifts
            }
        } else {
            // Clear the buffer and remove the object if the zone expires
            DangerMarker[i] = EMPTY_VALUE;
            if(ObjectFind(0, objName) >= 0) ObjectDelete(0, objName);
        }
    }
    
    return(rates_total);
}
//+------------------------------------------------------------------+

Re: Golden Week and Thanksgiving: Holiday-Specific Liquidity Patterns

Posted: Wed Oct 07, 2026 6:38 pm
by PTScalper
Implementing in an Expert Advisor (EA)

Because MT4 handles EA automation natively via iCustom, you do not need to paste this logic into your EA. You simply read the DangerMarker buffer (Buffer 0) from this indicator.

Inside your EA's entry condition, just call:
double dangerZone = iCustom(NULL, 0, "HolidayDangerZones_Overlay", 0, 1);

If dangerZone equals EMPTY_VALUE, the coast is clear and spreads are normal. If it returns a valid price (the location of the cross), your EA should hard-reject the trade entry.

Re: Golden Week and Thanksgiving: Holiday-Specific Liquidity Patterns

Posted: Wed Oct 07, 2026 6:39 pm
by PTScalper
Moving from MQL4 to MQL5 requires a complete structural overhaul. MT5 handles timeseries data, indicator buffers, and nested calculations completely differently.

Here is the native MQL5 translation. Key architectural changes include:

Indicator Handles: MT5 abandons iATR() direct calls in favor of an initialization handle (atrHandle) and CopyBuffer().

Manual Baseline Calculation: MQL5 removed iMAOnArray. To calculate the baseline SMA of the ATR without creating a complex secondary custom indicator, this script uses a highly efficient manual for loop across the retrieved ATR buffer.

Array Series Binding: MT5 processes arrays from oldest to newest by default (the opposite of MT4). The script uses ArraySetAsSeries() to force the arrays to behave like Pine Script and MT4, where [0] is the current live candle.

Re: Golden Week and Thanksgiving: Holiday-Specific Liquidity Patterns

Posted: Wed Oct 07, 2026 6:39 pm
by PTScalper
MQL5 version: 1.01

Code: Select all

//+------------------------------------------------------------------+
//|                                  HolidayDangerZones_Overlay.mq5  |
//+------------------------------------------------------------------+
#property copyright "Generated for MT5"
#property version   "1.00"
#property indicator_chart_window

#property indicator_buffers 1
#property indicator_plots   1

#property indicator_label1  "Danger Marker"
#property indicator_type1   DRAW_ARROW
#property indicator_color1  clrRed

// =============================================================================
// INPUTS & TOGGLES
// =============================================================================
input string   grp1 = "--- Calendar Holiday Filters ---";
input bool     ShowXmasNY      = true;      // Christmas to New Year
input bool     ShowGolden      = true;      // Japanese Golden Week
input bool     ShowUSThanks    = true;      // US Thanksgiving & Friday
input bool     ShowAugust      = false;     // August Summer Drain

input string   grp2 = "--- Dynamic Volatility Filter ---";
input bool     UseVolFilter    = true;      // Enable Dynamic Vol Filter
input int      AtrLen          = 14;        // ATR Length
input int      BaselineLen     = 100;       // Baseline Length (SMA of ATR)
input double   DropThreshold   = 70.0;      // Vol Drop Threshold (%)

input string   grp3 = "--- Spread Widening Proxy ---";
input bool     UseSpreadFilter = true;      // Enable Spread Proxy
input double   GapAtrPercent   = 15.0;      // Max Allowed Gap (% of ATR)
input double   BodyMaxPercent  = 25.0;      // Max Body Size (% of Total Candle)

input string   grp4 = "--- Visualization Colors ---";
input color    ColorXmas       = clrRed;
input color    ColorGolden     = clrOrange;
input color    ColorUS         = clrBlue;
input color    ColorAug        = clrPurple;
input color    ColorVol        = clrSilver;
input color    ColorSpread     = clrYellow;

// Buffers & Handles
double DangerMarker[];
double atrBuffer[];
int    atrHandle;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit() {
    SetIndexBuffer(0, DangerMarker, INDICATOR_DATA);
    PlotIndexSetInteger(0, PLOT_ARROW, 133); // Wingdings cross
    
    // Initialize ATR Handle
    atrHandle = iATR(_Symbol, _Period, AtrLen);
    if(atrHandle == INVALID_HANDLE) {
        Print("Failed to create ATR handle");
        return(INIT_FAILED);
    }
    
    ArraySetAsSeries(atrBuffer, true);
    ObjectsDeleteAll(0, "DZ_VLine_");
    
    return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void OnDeinit(const int reason) {
    ObjectsDeleteAll(0, "DZ_VLine_");
    IndicatorRelease(atrHandle);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[]) {
                
    if(rates_total < BaselineLen + 1) return(0);

    // Force MT4/Pine array orientation (0 = current candle)
    ArraySetAsSeries(time, true);
    ArraySetAsSeries(open, true);
    ArraySetAsSeries(high, true);
    ArraySetAsSeries(low, true);
    ArraySetAsSeries(close, true);
    
    // Copy ATR data for our calculations
    if(CopyBuffer(atrHandle, 0, 0, rates_total, atrBuffer) <= 0) return(0);
    
    int limit = rates_total - prev_calculated;
    if(prev_calculated == 0) limit = rates_total - BaselineLen - 1; 
    
    for(int i = limit; i >= 0; i--) {
        // Prevent array out of bounds on the oldest candles
        if(i + BaselineLen >= rates_total) continue;

        double currentAtr = atrBuffer[i];
        
        // Manual calculation of Baseline SMA of the ATR
        double sumAtr = 0.0;
        for(int j = 0; j < BaselineLen; j++) {
            sumAtr += atrBuffer[i + j];
        }
        double baselineAtr = sumAtr / BaselineLen;
        
        // Convert datetime to structure for calendar checks
        MqlDateTime dt;
        TimeToStruct(time[i], dt);
        int m = dt.mon;
        int d = dt.day;
        int dow = dt.day_of_week; // 0 = Sunday ... 4 = Thursday, 5 = Friday
        
        // 1. Calendar Logic
        bool isXmasNY = ShowXmasNY && ((m == 12 && d >= 24) || (m == 1 && d <= 2));
        bool isGoldenWeek = ShowGolden && ((m == 4 && d >= 29) || (m == 5 && d <= 5));
        
        bool isThanksgiving = (m == 11 && dow == 4 && d >= 22 && d <= 28);
        bool isBlackFriday  = (m == 11 && dow == 5 && d >= 23 && d <= 29);
        bool isUSHoliday = ShowUSThanks && (isThanksgiving || isBlackFriday);
        
        bool isAugust = ShowAugust && (m == 8);
        
        // 2. Dynamic Volatility Logic
        bool isVolDead = UseVolFilter && (currentAtr < (baselineAtr * (DropThreshold / 100.0)));
        
        // 3. Spread Widening Proxy Logic
        double prevClose = (i + 1 < rates_total) ? close[i+1] : open[i];
        double gapSize = MathAbs(open[i] - prevClose);
        bool isGapSpike = UseSpreadFilter && (gapSize > (currentAtr * (GapAtrPercent / 100.0)));
        
        double candleRange = high[i] - low[i];
        double candleBody = MathAbs(close[i] - open[i]);
        bool isWickSpike = UseSpreadFilter && (candleRange > (currentAtr * 0.8)) && (candleBody < (candleRange * (BodyMaxPercent / 100.0)));
        
        bool isSpreadSpike = isGapSpike || isWickSpike;
        
        // Master Filter Boolean
        bool isDangerZone = isXmasNY || isGoldenWeek || isUSHoliday || isAugust || isVolDead || isSpreadSpike;
        
        string objName = "DZ_VLine_" + IntegerToString(time[i]);
        
        if(isDangerZone) {
            DangerMarker[i] = low[i] - (currentAtr * 0.5);
            
            color bgColor = clrNONE;
            if(isXmasNY) bgColor = ColorXmas;
            else if(isGoldenWeek) bgColor = ColorGolden;
            else if(isUSHoliday) bgColor = ColorUS;
            else if(isAugust) bgColor = ColorAug;
            else if(isVolDead) bgColor = ColorVol;
            else if(isSpreadSpike) bgColor = ColorSpread;
            
            if(ObjectFind(0, objName) < 0) {
                ObjectCreate(0, objName, OBJ_VLINE, 0, time[i], 0);
                ObjectSetInteger(0, objName, OBJPROP_COLOR, bgColor);
                ObjectSetInteger(0, objName, OBJPROP_BACK, true);
                ObjectSetInteger(0, objName, OBJPROP_WIDTH, 5);
                ObjectSetInteger(0, objName, OBJPROP_STYLE, STYLE_SOLID);
                ObjectSetInteger(0, objName, OBJPROP_SELECTABLE, false);
                ObjectSetInteger(0, objName, OBJPROP_HIDDEN, true);
                ObjectSetString(0, objName, OBJPROP_TOOLTIP, "\n");
            } else {
                ObjectSetInteger(0, objName, OBJPROP_COLOR, bgColor);
            }
        } else {
            DangerMarker[i] = EMPTY_VALUE;
            if(ObjectFind(0, objName) >= 0) ObjectDelete(0, objName);
        }
    }
    return(rates_total);
}
//+------------------------------------------------------------------+

Re: Golden Week and Thanksgiving: Holiday-Specific Liquidity Patterns

Posted: Wed Oct 07, 2026 6:40 pm
by PTScalper
Implementing in an MT5 Expert Advisor

In MQL5, reading from a custom indicator in an EA requires three specific steps, as you cannot just call iCustom inside your OnTick condition like you do in MT4.

Get the Handle (in OnInit):

Code: Select all

int dangerZoneHandle = iCustom(_Symbol, _Period, "HolidayDangerZones_Overlay");

Re: Golden Week and Thanksgiving: Holiday-Specific Liquidity Patterns

Posted: Wed Oct 07, 2026 6:40 pm
by PTScalper
Create an Array (in OnTick):

Code: Select all

double dangerBuffer[];
ArraySetAsSeries(dangerBuffer, true);