Bar Formation Speed Study
A finished bar's high and low say nothing about when that range was covered. A bar that spikes in the first minute and drifts sideways for the rest of its formation looks identical, on the closed chart, to one that grinds steadily the whole way - but a trader deciding how long to wait for a setup to develop needs exactly that information, and it is not visible after the fact. This script reconstructs it. For each parent-timeframe bar it walks the child-timeframe bars that built it, in order, tracking a running high and low. At a configurable number of equally spaced points through the bar's formation (10% through, 20% through, and so on by default) it records what fraction of the bar's EVENTUAL total range had already been covered by that point. Averaged across many bars and split by hour of day, this turns into a formation-speed curve per hour: some hours front-load their range early, others build it out steadily or back-load it near the close. Only parent bars with enough child bars to sample the requested number of checkpoints are used - a parent timeframe with too few children per bar (for example M15 parents built from H1 children) produces no usable curve and is silently skipped rather than padded with duplicate readings. Notes and limitations - Checkpoints are spaced by CHILD BAR COUNT, not by elapsed time - on a symbol with irregular child-bar gaps (weekend edges, thin-liquidity sessions), the checkpoints are still even by bar count, not by clock time. - A parent bar is only used once its child bars are all in the past - the most recent, possibly still-forming parent bar is always excluded so its "eventual range" is not read prematurely. - This is a descriptive study of past bars, not a live progress indicator; it does not watch the currently forming bar or update on new ticks. - Hours with very few qualifying parent bars in the loaded history should be read with that sample size in mind - the log's bar count column is there specifically so a thin hour is not mistaken for a reliable one.
Script · MT4 · v1.0 · Free
About Bar Formation Speed Study
Bar Formation Speed Study 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, Parent tf and Child tf. MQL source code included.
Files in the download: BarFormationSpeedStudy.mq4, BarFormationSpeedStudy.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol to study, blank = this chart's symbol | |
| Parent tf | PERIOD_H1 | Timeframe whose bars are reconstructed |
| Child tf | PERIOD_M1 | Finer timeframe used to sample formation progress |
| Max parent bars | 1000 | Most recent parent bars to include |
| Progress steps | 10 | How many equal progress checkpoints per bar (10 = every 10%) |
| Save csv | true | Write the per-hour average curve to a CSV file |
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: Alerts · MT4 Script · MQL4 Source Code