Skip to content
All library documents

Using Pearson Correlation with Lagged or Separate Symbols

Article MQL5 code base

Summary

This short indicator description defines Pearson correlation as covariance divided by the product of the variables’ standard deviations. It presents an indicator that can calculate correlation for a chart symbol against itself at a lag, or compare the chart symbol with a second symbol. For a self-comparison, the lag must be positive; a zero lag yields zero according to the document. For a separate symbol, a zero lag compares corresponding bars, while a nonzero lag shifts the second symbol’s data.

The suggested use is to treat a deviation from an expected correlation as a possible signal in a correlation-trading approach. The note provides no trading rules for defining expected correlation or the size and timing of a deviation, and it reports no test results. It therefore explains the indicator’s parameter behavior and a possible application, but does not establish that any correlation signal is profitable or robust.

Key ideas

  • Pearson correlation scales covariance by both variables’ standard deviations.
  • The indicator supports self-correlation with a lag or correlation between two symbols.
  • A positive lag is required for the described self-correlation calculation.
  • A lag on the second symbol shifts its data relative to the chart symbol.
  • Correlation deviations are suggested as possible trading signals, without performance evidence.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.