Hourly Edge After Costs Table
Ranking hours purely by gross pip movement is a common but misleading exercise: the hour with the widest raw range is sometimes also the hour with the widest spread, and once that cost is paid twice (in, then out) the apparent edge can be smaller than it looked, or gone entirely. This script computes the mean signed close-minus-open drift for every server-time hour across the requested H1 history, then subtracts a cost figure from the absolute value of that drift to produce a net edge in pips. The cost defaults to the symbol's live current spread, read from the market at the moment the script runs, never a hardcoded number - spread varies by instrument and by broker, and baking in a fixed figure would misprice every symbol that isn't the one it was tuned for. An optional extra allowance can be added on top to represent slippage or commission, and a fixed-spread override exists for studying a symbol whose live quote is unavailable (market closed, no active subscription). The table also reports each hour's sample count and the percentage of bars that closed above their own open, so a trader can see whether an hour's "edge" comes from a small, decisive minority of large moves or a broad, if narrow, majority. Notes and limitations - The cost model is spread-only by default (plus the optional extra allowance); it does not model variable/dynamic spread that widens around news, only whatever the spread happens to read at run time. - Net edge is computed against the absolute value of the mean drift, so it answers "is this hour worth trading in its own average direction", not "is this hour worth trading in both directions". - This is a historical base-rate study, not a live signal generator - it does not place, size or manage trades.
Script · MT4 · v1.0 · Free
About Hourly Edge After Costs Table
Hourly Edge After Costs Table is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Symbol, Max bars and Extra cost pips. MQL source code included.
Files in the download: HourlyEdgeAfterCosts.mq4, HourlyEdgeAfterCosts.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol to study, blank = this chart's symbol | |
| Max bars | 5000 | Most recent H1 bars to include |
| Extra cost pips | 0.0 | Extra allowance added to the live spread, pips (slippage/commission estimate) |
| Use fixed spread | false | Use InpFixedSpreadPips below instead of the live current spread |
| Fixed spread pips | 1.0 | Spread to assume, pips, only used when InpUseFixedSpread is true |
| Save csv | true | Write the hourly table to a CSV file |
| Delimiter | DelimiterComma | CSV column separator |
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