Two Window Comparison Report
A single combined average across a long history can hide a genuine regime change - a symbol that trended for a year and then chopped for six months averages out to something that resembles neither period on its own. This script computes bar count, mean signed drift, drift standard deviation, mean range, up-close percentage and the min/max drift seen, once for each of two explicitly chosen date windows on the same symbol and timeframe, and prints both columns next to each other so the two periods can be compared directly rather than by re-running a single-window study twice and lining the numbers up by hand. Each window is resolved with iBarShift against the requested start and end dates, then every bar whose own open time falls inside the window is scanned individually - a bar landing exactly on a window's edge is included, matching an inclusive [start, end] reading of the dates as entered. Notes and limitations - Both windows need enough loaded history on the chosen timeframe/ symbol to be covered - if a window returns zero bars, check that the terminal actually has that much history downloaded (History Center, or "Load more history" on the chart) before assuming the result is meaningful. - This is a historical base-rate study, not a live signal generator - it does not place, size or manage trades. - The two windows are independent and may overlap; the script does not check for or warn about overlap, since a partial-overlap comparison (e.g. "this month" vs "this quarter") can be a deliberate, valid use.
Script · MT4 · v1.0 · Free
About Two Window Comparison Report
Two Window Comparison Report is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 6 settings, such as Symbol, Timeframe and Window1 start. MQL source code included.
Files in the download: TwoWindowComparison.mq4, TwoWindowComparison.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol to study, blank = this chart's symbol | |
| Timeframe | PERIOD_H1 | Bar timeframe used for both windows |
| Window1 start | D'2023.01.01 00:00' | Window 1 start (inclusive) |
| Window1 end | D'2023.06.30 23:59' | Window 1 end (inclusive) |
| Window2 start | D'2023.07.01 00:00' | Window 2 start (inclusive) |
| Window2 end | D'2023.12.31 23:59' | Window 2 end (inclusive) |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Trend · Alerts · MT4 Script · MQL4 Source Code