Loading…

DST Regime Split Analyzer

An hour-of-day study that groups bars purely by server hour is silently averaging together two different real-world market hours whenever the broker observes daylight saving - "server hour 13" covers one real trading hour for half the year and a different one for the other half, and most published studies never split the two apart. This script finds the exact regime boundaries the same way BrokerDstTransitionTable.mq4 does: by detecting the 23-hour or 25-hour gap a clock change leaves between consecutive H1 bars, rather than assuming a textbook DST calendar that rarely matches a specific broker's actual schedule. Once every transition in the loaded history is found and dated, the script walks the H1 series a second time, toggling between "summer" and "winter" state at each transition, and aggregates mean and standard deviation of bar range per server hour separately for each regime. The output is a straightforward side-by-side table: for every server hour, the summer sample count/mean/stdev sits next to the winter sample count/mean/stdev. An hour whose two columns diverge materially is proof that a single-regime hour study on this symbol is mixing two different market hours under one label. Notes and limitations - If zero DST transitions are detected, either this broker's server clock does not observe daylight saving, or the loaded history does not reach far enough back to span a transition - the script reports which situation it found rather than guessing. - The very first regime (before the earliest detected transition) is inferred from the TYPE of that first transition, since no transition exists before it to confirm directly. - A symbol with irregular gaps in its own price history for reasons unrelated to DST (thin liquidity, a data outage) can occasionally be misclassified as a transition - cross-check an unexpected transition date against a well-established major on the same broker. - The statistic split here is mean H1 bar range; adapting the aggregation block to a different per-bar statistic is a small code change for anyone comfortable reading the source.

Script · MT5 · v1.0 · Free

About DST Regime Split Analyzer

DST Regime Split Analyzer is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Symbol, Max bars and Save csv. MQL source code included.

Files in the download: DstRegimeSplitAnalyzer.ex5, DstRegimeSplitAnalyzer.mq5, DstRegimeSplitAnalyzer.txt.

Settings

SettingDefaultWhat it does
SymbolSymbol to study, blank = this chart's symbol
Max bars20000Most recent H1 bars to scan (bounds run time on very long history)
Save csvtrueWrite the per-hour, per-regime table to a CSV file

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Trading Sessions · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria