Loading…

Correlation Break Alert

Traders who watch a pair of normally-correlated instruments (two commodity currencies, a metal and its related currency, a symbol and an index) usually notice a dislocation late - by the time it is obvious on two side-by-side charts, the move that caused it is often already over. This indicator watches the relationship directly: it computes rolling correlation of bar-to-bar returns between the chart symbol and a second symbol, and alerts the moment that correlation falls below a threshold measured relative to a level you supply as "normal" for this pair. "Normal" is deliberately a trader-supplied input (InpNormalCorrelation) rather than something the indicator estimates for itself. A self-estimated baseline would need many months of stable history before it could be trusted, and would keep silently redefining "normal" as more history streamed in behind it. Stating the assumption explicitly is more honest - the trader who knows this pair usually sits around 0.8 correlation supplies that number, and the indicator's job is only to watch for a genuine break away from it. Correlation is computed on RETURNS, not price levels, so two symbols sharing an unrelated long-term drift cannot inflate the reading - only genuine bar-to-bar co-movement counts. The alert fires only on the falling edge through the break level, once per closed bar, so a correlation sitting just under the line does not spam the same warning on every subsequent bar. Notes and limitations - "Normal" correlation is a trader-supplied assumption, not a fitted baseline - a poorly chosen InpNormalCorrelation makes the alert either too trigger-happy or too quiet for the pair in question. - Both symbols are read at the same bar shift index, which assumes they share the chart's timeframe and closely aligned session hours - accurate for most forex pairs on the same broker feed. - Correlation is a backward-looking descriptive statistic, not a forecast; a genuine break can also be a false alarm that reconverges within a few bars. - Values are computed strictly from closed bars, so nothing plotted here repaints on a later tick; only the alert timing depends on the bar actually closing.

Indicator · MT4 · v1.0 · Free

About Correlation Break Alert

Correlation Break Alert is an indicator for MetaTrader 4 based on Divergence. It can alert you with a pop-up, sound, email or push message. It has 6 settings, such as Second symbol, Symbol suffix and Lookback bars. MQL source code included.

Files in the download: CorrelationBreakAlert.ex4, CorrelationBreakAlert.mq4, CorrelationBreakAlert.txt.

Settings

SettingDefaultWhat it does
Second symbolGBPUSDSymbol normally correlated with the chart symbol
Symbol suffixBroker suffix appended to InpSecondSymbol, leave blank if none
Lookback bars20Rolling correlation window, in closed bar-to-bar returns
Normal correlation0.7The correlation level you consider "normal" for this pair
Divergence threshold0.3How far below InpNormalCorrelation counts as a break
AlertstrueAlert once per closed bar on the break

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