Skip to content
All library documents

Using Price Correlation with a Straight-Line Trend to Generate Signals

Article MQL5 code base

Summary

This note describes a trend indicator based on the correlation between a security’s price history and an idealized straight-line trend. The underlying approach, attributed to John Ehlers, is intended to identify the beginning of trends and recognize when they fail. The note recommends treating the zero line as a directional trend filter and using crosses between short-period and long-period indicator values as buy or sell signals.

It cautions against tuning asymmetric thresholds to fit an individual chart, since that risks overfitting. Two implementations are mentioned: a straightforward version and an optimized version that reportedly produces the same results while running substantially faster. The note gives no test results, parameter settings, or evidence that the suggested signal rules are profitable across markets. Its guidance is a brief implementation and interpretation summary, so users would need to validate the indicator and signal behavior on their own data, including transaction costs and out-of-sample periods.

Key ideas

  • The indicator measures how closely recent prices correlate with a straight-line trend.
  • The zero line can be used to distinguish positive and negative trend conditions.
  • Crosses between short-period and long-period indicator values are proposed as entry or exit signals.
  • Chart-specific asymmetric thresholds can create overfitting risk.
  • An optimized implementation is reported to match the basic version while calculating faster.

Tags

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