Volume Participation Scheduler
A fixed time schedule sends the same size at 3am as at the London open, even though that 3am clip is a far larger fraction of the thin overnight book and moves the price proportionally more. This library builds a real historical volume profile instead - average tick volume per time-of-day bucket, taken from actual bars and normalised so the profile sums to 1.0 - and paces the parent order against that shape: heavier buckets get proportionally larger slices, thin buckets get smaller ones. The profile is built by bucketing every historical bar's time of day, in a chosen timeframe over a chosen lookback, regardless of which calendar day it fell on, then averaging volume within each bucket. This is the same idea behind a standard percentage-of-volume (POV) execution algorithm, sized down to what a retail terminal's own tick-volume feed can support: neither MQL4's nor MQL5's own tick-volume reading is a literal traded-contract count on most retail feeds, so this is a reasonable proxy for activity, not a literal one - said plainly here rather than implied. Two layers are provided. VpsAllocateSlicesToProfile does a one-shot static split of the parent size across the day's buckets, useful for planning. VpsLotsDueNow is the live pacing function: given how much has already been sent and which bucket the clock is currently in, it returns exactly how much is due right now to stay on the volume-weighted pace - never a negative number, because this library only ever proposes sending forward, never unwinding a position that got ahead of pace. Like every execution header in this catalogue, this one only decides sizes and targets. It never sends a trade request, and it never tracks whether a proposed slice actually filled - that bookkeeping, along with all retry and slippage handling, belongs entirely to the calling EA. Notes and limitations - Tick volume is a proxy for activity on most retail feeds, not a literal count of traded contracts - treat the profile's shape as directional, not as an exact participation percentage of real market volume. - The profile bins by time of day only; it has no concept of "today is a holiday" or "there is high-impact news at 14:30 today" - a caller who needs that should combine this with a separate calendar or volatility filter. - VpsBuildVolumeProfile requires at least one bar in every bucket across the requested lookback or it refuses outright, rather than silently reporting a profile with zeroed sections of the day. - VpsLotsDueNow trusts lotsSentSoFar completely; if the caller's own fill bookkeeping drifts from what actually executed at the broker, the pacing decision drifts with it. Reconcile against the real order/position pool periodically - see the Position Reconciler in this catalogue for that specific job. - Pure computation only. Nothing here sends an order or tracks fills; the caller owns both.
Script · MT5 · v1.0 · Free
About Volume Participation Scheduler
Volume Participation Scheduler is a script for MetaTrader 5. It has 4 settings, such as Total lots, Buckets per day and Lookback days. MQL source code included.
Files in the download: VolumeParticipationScheduler.mq5.mqh, VolumeParticipationScheduler.txt, VolumeParticipationSchedulerDemo.ex5, VolumeParticipationSchedulerDemo.mq5.
Settings
| Setting | Default | What it does |
|---|---|---|
| Total lots | 1.00 | Parent order size to pace |
| Buckets per day | 24 | Buckets per day, 24 = hourly |
| Lookback days | 10 | Trading days of M15 history requested |
| Timeframe | PERIOD_M15 | Bar timeframe used to build the profile |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Volume · Trading Sessions · MT5 Script · MQL5 Source Code