AETERNAE AI RESEARCH LLC INDEPENDENT RESEARCH
ÆAETERNAERESEARCH
Sign inRequest access
← Malware catalog

Attributed metadata history

REPORTPUBLIC METADATA

Detecting the Monday open gap in MQL5 and deciding what your EA should do

Forex and CFD prices keep moving over the weekend while the market is closed. When trading resumes, the first price can be far away from Friday's close. Backtests on bar data often treat that jump like any other move, but live it can trigger entries at prices your logic never expected, and it can push stop orders through their levels. A small gap check at the start of the week lets the EA make a deliberate choice instead of reacting by accident. Measuring the gap The idea is simple: compare the open of the first bar of the new session with the close of the last bar before the break. On the H1 chart the break shows up as a time difference much larger than one bar. // Returns the gap in points if the current bar is the first after a long break, else 0 double SessionGapPoints(const string sym, ENUM_TIMEFRAMES tf, int minBreakHours = 24) { MqlRates r[]; ArraySetAsSeries(r, true); if(CopyRates(sym, tf, 0, 2, r) < 2) return 0.0; long breakSeconds = (long)(r[0].time - r[1].time); if(breakSeconds < (long)minBreakHours * 3600) return 0.0; double point = SymbolInfoDouble(sym, SYMBOL_POINT); if(point <= 0.0) return 0.0; return MathAbs(r[0].open - r[1].close) / point; } Using the time difference instead of checking for Monday makes it work for holiday breaks too, and for brokers whose server week does not start on Monday in your local time. Turning the number into a decision Once you know the size of the gap, there are a few reasonable policies. Pick one on purpose and write it into the strategy rules. Skip new entries for the first bar or the first N minutes after a large gap, so the spread and the order book can settle. Compare the gap with the ATR. A gap of 0.3 ATR is noise; a gap of 2 ATR means the setup the EA saw on Friday no longer exists. Cancel or re validate pending orders that were placed before the break, since their levels were chosen against old prices. input double InpMaxGapAtr = 1.0; // block entries if gap is larger than this many ATRs input int InpAtrPeriod = 14; int atrHandle = INVALID_HANDLE; int OnInit() { atrHandle = iATR(_Symbol, PERIOD_H1, InpAtrPeriod); return atrHandle == INVALID_HANDLE ? INIT_FAILED : INIT_SUCCEEDED; } bool GapAllowsTrading() { double gapPts = SessionGapPoints(_Symbol, PERIOD_H1); if(gapPts == 0.0) return true; double atr[]; if(CopyBuffer(atrHandle, 0, 1, 1, atr) < 1) return false; // no data yet, stay out double atrPts = atr[0] / SymbolInfoDouble(_Symbol, SYMBOL_POINT); bool ok = gapPts <= InpMaxGapAtr * atrPts; PrintFormat("Session gap %.0f pts vs ATR %.0f pts, trading %s", gapPts, atrPts, ok ? "allowed" : "blocked for this bar"); return ok; } Call GapAllowsTrading() inside your new bar logic before any entry. Because it only looks at the current and previous bar, the block lasts exactly one bar on the chosen timeframe, which is usually enough for spreads to normalize. Test it where the gaps are The Strategy Tester will reproduce gaps if you test with real tick data across many weekends. Look at the journal lines from the PrintFormat above and check that the blocked bars match the weekends you remember as volatile. If the EA never blocks anything over two years of data, your threshold is too loose to matter. A gap rule rarely changes the headline backtest numbers much, but it removes a class of live trades that the strategy was never designed to take.

Reference details

Source category
research-report
First reported
Dec 04, 2026 06:18 UTC
Last reported
Dec 04, 2026 06:18 UTC
Catalog updated
Dec 04, 2026 06:27 UTC
Record ID
6465059aa533249e3df73bb1eb337e57f47374d195994bf3f4c577a19d091917

Published indicators

Network indicators are visibly defanged. This page does not make them clickable or send them to another service.

No validated file hashes or network indicators are stored for this record.

Source observations

intelligence_src_6dc544294b7f21f98a

Source-provided label
Publisher RSS metadata
Evidence class
mentioned in report
Confidence
Not reported
Observed
Dec 04, 2026 06:18 UTC
Retrieved
Dec 04, 2026 06:27 UTC

This record contains metadata and attribution only. It does not host, download, unpack, render, or execute malware samples.

Feed collection status

Sources represented on this page. Publication and observation dates describe the content; successful batch dates describe local collection. A recent batch does not certify complete coverage or current provider availability.

1 sources: 0 stale, 0 needing attention, 0 paused, 0 unverified.

Review source update dates and status
  • intelligence_src_6dc544294b7f21f98aRecent successful batchLast successful batch: Last attempt:

Stale means older than twice the recorded collection interval, with a minimum of one hour; without an interval, the threshold is 24 hours. Cached content remains available while a feed is stale, paused, or unverified.