Expected Spread Ribbon
Most spread displays only show the number right now. That is fine at the moment you look, but useless for planning - a trader deciding whether to place a limit order for later tonight has no idea whether spread widens at that hour on this symbol. This indicator keeps a running average spread for each of the 168 hour-of-week buckets (Sunday 00:00 through Saturday 23:00, server time) built from live ticks while it is attached to the chart. Once a bucket has enough samples, the ribbon shows that learned average for the corresponding future hour instead of just repeating today's live number. The ribbon is drawn as a strip of coloured rectangles in the empty chart space to the right of the current price - green for tight expected spread through red for wide - so a trader scanning tonight's session can see at a glance which hours are historically calm and which are historically choppy on this exact symbol and this exact broker feed. The learned table is saved to a plain CSV file in the sandbox on a timer and on shutdown, so restarting the terminal does not throw the learning away. Notes and limitations Learning only happens while the indicator is attached and receiving ticks - it does not back-fill from tick history, so a freshly attached chart starts with an empty (grey) ribbon and needs real running time to become useful. The forward ribbon is drawn using future-dated chart objects, which only render if the chart's "Chart Shift" option is on; without it the objects still exist but sit off-screen until you scroll. Spread behaviour also depends on broker liquidity conditions on the day, not only the hour of the week, so treat the ribbon as a seasonality guide, not a guarantee.
Indicator · MT5 · v1.0 · Free
About Expected Spread Ribbon
Expected Spread Ribbon is an indicator for MetaTrader 5. It has 8 settings, such as Hours ahead, Min samples and Spread color scale max. MQL source code included.
Files in the download: ExpectedSpreadRibbon.ex5, ExpectedSpreadRibbon.mq5, ExpectedSpreadRibbon.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Hours ahead | 12 | Hours ahead to paint (1-72) |
| Min samples | 20 | Minimum recorded ticks in a bucket before it is trusted |
| Spread color scale max | 40 | Spread (points) that maps to the reddest colour |
| Band offset points | 150 | Vertical offset of the ribbon above current Bid (points) |
| Band height points | 60 | Ribbon band height (points) |
| Show labels | true | Show the spread value on each ribbon segment |
| Save interval seconds | 300 | How often the learned table is written to disk |
| Data file override | Optional explicit data file name; blank = auto per symbol |
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 → Indicators.
- 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 indicator from the Navigator onto a chart and adjust the settings.
Tags: MT5 Indicator · MQL5 Source Code