Symbol Ratio Chart
Two correlated instruments can both be rising and still tell very different stories depending on which is rising faster. This indicator divides the chart symbol's close by a chosen second symbol's close, bar for bar, and plots the result as its own line in a separate window, alongside a moving average of that ratio - is the chart symbol out- or under-performing the one it is measured against, and is that lead widening or narrowing. The naive way to build this is to compare the two symbols' closes by bar index. That silently breaks the moment the two symbols' histories do not line up perfectly - a different session calendar, a different broker feed, a missing holiday - and pairs bars that never actually happened at the same moment. This indicator matches every bar by its actual timestamp using iBarShift() instead, so the ratio only ever compares two closes that genuinely occurred together. The second symbol is added to Market Watch automatically on load, since a symbol the terminal has never subscribed to returns empty history indefinitely rather than just loading slowly. Notes and limitations - If the second symbol has not finished downloading history when the indicator loads, the ratio line will be empty until it does - a warning is printed once to the Experts log rather than repeatedly. - The ratio has no natural unit and no fixed scale; read it for direction and slope, not for an absolute level that means something on its own. - Comparing two genuinely uncorrelated instruments produces a ratio line that is just noise - this tool assumes the two symbols chosen have some real relationship worth tracking. - The moving average only prints once every close in its lookback window is available, so it lags the ratio line briefly after each history load.
Indicator · MT4 · v1.0 · Free
About Symbol Ratio Chart
Symbol Ratio Chart is an indicator for MetaTrader 4. It has 3 settings, such as Second symbol, Ma period and Ma method. MQL source code included.
Files in the download: SymbolRatioChart.ex4, SymbolRatioChart.mq4, SymbolRatioChart.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Second symbol | GBPUSD | Symbol to divide the chart symbol by |
| Ma period | 20 | Moving average period applied to the ratio |
| Ma method | MODE_SMA | Moving average method |
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 → Indicators.
- 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 indicator from the Navigator onto a chart and adjust the settings.
Tags: Moving Average · MT4 Indicator · MQL4 Source Code