Loading…

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

SettingDefaultWhat it does
Hours ahead12Hours ahead to paint (1-72)
Min samples20Minimum recorded ticks in a bucket before it is trusted
Spread color scale max40Spread (points) that maps to the reddest colour
Band offset points150Vertical offset of the ribbon above current Bid (points)
Band height points60Ribbon band height (points)
Show labelstrueShow the spread value on each ribbon segment
Save interval seconds300How often the learned table is written to disk
Data file overrideOptional explicit data file name; blank = auto per symbol

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: MT5 Indicator · MQL5 Source Code

MetaTrader 4 & 5 indicators · PolyMaria