Loading…

Spot Future Spread Meter

Some brokers quote both a cash/spot instrument and a related futures or CFD contract on the same symbol list - a cash index next to its front-month future, a spot metal next to its futures contract. The gap between the two is not a fixed number: it moves with time to expiry, financing rates and demand for each leg, so a naive fixed-pip alert either fires constantly or never fires at all depending on which instrument it was tuned on. This indicator instead tracks the raw spread (futures close minus spot close) alongside its own InpAveragePeriod-bar rolling average, so "wide" and "narrow" are judged against this specific pair's own recent behaviour rather than an arbitrary constant. An optional alert fires once per closed bar when the current spread pulls away from its own average by more than InpDivergenceThreshold price units. Both legs are read independently through iClose with no assumption about either symbol's contract size, tick value or margining - those are broker and instrument specific and this tool only ever compares quoted prices, not position value. Notes and limitations Requires the broker to actually quote both symbols - if InpFuturesSymbol is not available, the lines read empty and a one-time warning is printed to the Experts log. The average needs a full InpAveragePeriod window of closed bars on both symbols; recently-listed futures contracts will show a shorter usable history than the spot leg. This tool compares raw quoted prices only - it does not attempt to convert either leg into account-currency P/L or account for either instrument's own contract size, margining or expiry roll, all of which are broker/contract specific and outside a chart indicator's scope.

Indicator · MT4 · v1.0 · Free

About Spot Future Spread Meter

Spot Future Spread Meter is an indicator for MetaTrader 4 based on Divergence. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Futures symbol, Symbol suffix and Average period. MQL source code included.

Files in the download: SpotFutureSpreadMeter.mq4, SpotFutureSpreadMeter.txt.

Settings

SettingDefaultWhat it does
Futures symbolRelated futures/CFD symbol quoted alongside the chart's spot symbol (required)
Symbol suffixBroker suffix appended to InpFuturesSymbol, leave blank if none
Average period20Bars the spread's own rolling average is built over
Divergence threshold0.0Alert when |spread - average| exceeds this, in price units of the spot symbol (0 = never)
AlertstrueAlert once per closed bar when the divergence threshold is crossed

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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: Alerts · Divergence · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria