Volume Spike Aftermath Study
A "volume climax" bar is often treated as a meaningful event without ever comparing what happens afterward to what an ordinary bar does over the same horizon. This script flags a bar as a spike when its tick volume exceeds the trailing mean by more than a chosen number of standard deviations, using a window that ends strictly BEFORE the bar being classified, so the classification never uses information the bar itself or anything after it provides. For every spike bar found, the script measures the close-to-close forward return over several horizons (1, 3, 5 and 10 bars by default, fully configurable) and reports the mean, standard deviation and win rate for each horizon, next to the SAME statistics computed over every classified bar regardless of whether it spiked - the honest baseline a spike-driven approach needs to beat. MT4 has no real traded-volume feed on most symbols; what the platform calls volume is tick volume, the count of price changes in the bar. This script uses tick volume and says so plainly rather than presenting it as traded volume, since the two are correlated but not identical. Notes and limitations - Daily timeframe only (PERIOD_D1). - Tick volume is used throughout, not real traded volume - see FULL DESCRIPTION. Results should be read as "after an unusually high count of price changes", which correlates with activity but is not a precise traded-volume figure. - The script refuses to run if no bar in the scanned window ever qualified as a spike at the chosen InpSpikeSigma; lower the threshold and re-run rather than reading an empty table. - This is a descriptive comparison against the symbol's own baseline, not a statistical significance test on the difference between the two groups - read the spike-vs-baseline gap as a magnitude to investigate further, not as proof of an edge, and remember it says nothing about spread or slippage around the spike bar itself.
Script · MT5 · v1.0 · Free
About Volume Spike Aftermath Study
Volume Spike Aftermath Study is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Max bars, Lookback and Spike sigma. MQL source code included.
Files in the download: VolumeSpikeAftermath.ex5, VolumeSpikeAftermath.mq5, VolumeSpikeAftermath.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Max bars | 3000 | Daily bars to scan (0 = all available) |
| Lookback | 20 | Trailing bars used for the volume mean/stdev |
| Spike sigma | 2.0 | Bar counts as a spike above mean + this many stdevs |
| Horizons | 1,3,5,10 | Forward horizons in bars, comma separated |
| Output file | VolumeSpikeAftermath.csv | Output file (in MQL5\Files) |
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 · Trailing Stop & Break-even · Alerts · MT5 Script · MQL5 Source Code