Finding the Closest ETF Price Pattern with Rolling Correlation
Summary
This indicator compares a chart’s recent closing-price sequence with a configurable set of ETFs. It calculates Pearson correlation over a chosen rolling window, identifies the ticker with the highest correlation, and displays both a best-match summary and a table of correlations. The default universe spans broad equity, sector, bond, commodity, and international funds, and users can change the tickers and window length.
The selected ETF’s recent path is overlaid on the chart after scaling it to the chart’s price range. A second display mode also adjusts the path to align its endpoints. The script’s notes describe performance optimizations, including updating calculations and drawings on the latest bar. This is a visual similarity tool, not a forecast or trading rule: a high correlation over one window does not establish that the relationship will persist or that either asset’s future returns will match.
Key ideas
- The indicator ranks a configurable ETF universe by Pearson correlation with the chart over a rolling window.
- It displays correlation values and highlights the ticker with the strongest measured match.
- The winning ETF’s recent price path is rescaled and drawn over the chart for visual comparison.
- Users can choose between simple scaling and a mode that also aligns the paths’ endpoints.
- Historical price similarity does not by itself establish predictive power or a tradable relationship.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.