Spread Monitor and Cost per Lot RMT
- インディケータ
-
Denis David Garcia Camejo
I build software and automation with a practical approach, applying AI, Python, API integrations and CRM workflows. On MQL5, I create RMT tools for MetaTrader 5: Expert Advisors, indicators and utilities focused on transparent rules, risk management and analysis support. I do not promise profits or - バージョン: 1.0
Free spread indicator for MetaTrader 5: the spread of every bar, the typical spread of each hour of the day, the widest spread seen live inside each bar, and what the spread costs for your lot size in your account currency.
What it shows
A separate window under the chart with:
- Spread of every bar (histogram). The value your broker stored in each bar of the history, in points.
- Typical spread of the hour (line). The average stored spread of each hour of the day over the last 20 days (you choose how many). You see at a glance which hours are cheap and which are expensive, for example the widening around the daily rollover.
- Live maximum (dots). While the indicator runs it reads every tick and marks the widest spread seen inside each bar. Short spikes that the stored bar value does not show become visible.
- A four-line panel: spread now, the maximum of the current bar and the maximum since the indicator was loaded, with its time; the cost of the spread for your lot size in your account currency, and the spread as a percentage of the average bar range; the tightest and the widest hour of the day; swap long and short per lot as the broker states it, and the triple-swap day.
The cost figure is checked, not estimated
The cost is contract size × spread × lots, converted to your account currency with the matching forex pair. In the Strategy Tester it was compared on every tick with MetaTrader's own profit calculation (OrderCalcProfit) on EURUSD, GBPUSD, EURGBP, USDJPY and XAUUSD, with accounts in USD and in EUR: 67 million ticks, and it never differed by more than half a cent. On a live demo it matched on forex majors, crosses and exotics, gold, silver and index CFDs.
When the cost cannot be calculated this way (exchange stocks, futures, or no pair to convert the currency), the panel says "n/a" and why. It never shows a guess.
Alert when the spread widens
Set a level in points. When the live spread goes above it you get an alert (pop-up, push notification to your phone, sound, each on or off), at most once per the number of seconds you choose.
For EA developers (iCustom)
Buffer 0 spread stored in the bar, 1 typical spread of the hour, 2 live spread, 3 live maximum in the bar, 4 cost in account currency, 5 spread as % of the average bar range. EMPTY_VALUE means nothing or not known. Buffers 2 to 5 exist only for bars that were open while the indicator was running. Inputs, in order: InpLots, InpProfileDays, InpAvgBars, InpShowPanel, InpAlertSpreadPts, InpAlertRepeatSec, InpAlertPopup, InpAlertPush, InpAlertSound.
Inputs
- InpLots — lot size used for the cost figure.
- InpProfileDays — days in the hour-of-day profile (0 = off).
- InpAvgBars — bars in the average bar range.
- InpShowPanel — show the text panel.
- InpAlertSpreadPts — alert when the spread is above this many points (0 = off).
- InpAlertRepeatSec — minimum seconds between two alerts.
- InpAlertPopup, InpAlertPush, InpAlertSound — how the alert reaches you.
Good to know
- Points are the broker's points (the last digit of the price), not pips.
- The stored bar spread is whatever your broker records in the bar; it can be lower than what you see live. That is why the live maximum is shown next to it.
- The hour-of-day line needs a chart of H1 or lower and uses the bars of the chart's timeframe; hours are the broker's server time.
- Live values start when the indicator is loaded and start again when the chart is reloaded. History has no live values.
- Commission is not included: MetaTrader does not expose it per symbol.
- If the conversion needs another pair (for example EURJPY for a EUR account on USDJPY), the indicator adds that pair to Market Watch.
- With a wrong input (lot size 0, for example) it draws nothing and says why on the panel.
- It reads prices only and sends no orders. It is a measuring tool, not a trading recommendation.
- Tested on the MetaQuotes demo server. Crypto, energies, futures and netting accounts were not tested.
Want the full broker check?
This indicator measures the spread over time. RMT Execution Inspector goes further on a single symbol: stops and freeze levels, volume limits, filling modes, margin, and a preflight of a hypothetical order with OrderCheck, without sending anything: https://www.mql5.com/en/market/product/201184
Trading involves risk of loss.
