Cosine Self Similarity
- Indikatoren
- Florian Nuebling
- Version: 1.10
- Aktivierungen: 5
Cosine-Self-Similarity: Identify Trends & Reversals
What is Cosine Similarity?
Cosine similarity measures how alike two sequences are by looking at the angle between them. A value of +1 means they move perfectly together, -1 means they move perfectly opposite, and 0 means there's no directional relationship. This indicator applies this concept to price returns.
Is the market trending strongly, or is it choppy and reversing? Gain insight with the Cosine-Self-Similarity indicator!
This powerful tool analyzes the directional consistency of recent price movements compared to slightly older movements using a sophisticated weighted cosine self-similarity metric. It helps you distinguish between trending, mean-reverting, and potentially reversing market conditions by focusing purely on the alignment of price return patterns, ignoring their magnitude.
Key Features & Interpretation:
Cosine Similarity Histogram:
- Displays the core weighted self-similarity value.
- What Higher/Rising Self-Similarity Indicates: High positive values (approaching +1, blue bars) mean consecutive return patterns are consistently aligned. This reflects steadiness and suggests TREND FORMATION or momentum persistence, as seen in trending markets where price continues moving in the same direction.
- What Lower/Falling Self-Similarity Indicates: Low or negative values (approaching 0 or -1, yellow bars) mean return patterns are less aligned, oscillating, or opposing. This suggests MEAN REVERSION or cyclical behavior, where prices oscillate without a clear directional trend, or potential REVERSALS.
Smoothed Similarity Line:
- A SuperSmoother filter clarifies the underlying similarity trend.
- Rising Line (blue): Increasing consistency – potential trend strengthening.
- Falling Line (yelloq): Decreasing consistency – potential trend weakening, chop, or reversal setup.
Statistical Bands (Mean, +/- 2 Standard Deviations):
- Show the average similarity and its recent volatility.
- Values hitting or exceeding the bands indicate statistically extreme levels of consistency or inconsistency, potentially highlighting exhaustion points.
Zero Line:
- A quick reference for positive (trending similarity) vs. negative (reversing similarity) regimes.
How to Use:
- Trend Confirmation: Look for sustained high positive histogram values (steadiness) and a rising (blue) smoothed line (momentum).
- Mean Reversion / Chop Detection: Look for histogram values oscillating around zero or negative (inconsistency), often with a falling (orange) smoothed line. This suggests returns are alternating direction.
- Potential Reversals: Extremely low/negative readings (opposition), or sharp moves from positive extremes back towards/below zero, can signal potential turning points when confirmed by price action.
- Regime Filter: Use the indicator's state (high/rising similarity vs. low/falling similarity) to adapt your strategy (e.g., favour trend-following in high similarity; favour mean-reversion in low similarity).
Input Parameters:
- Sample Size: (Default: 100) The main lookback period for comparing return sequences. Adjust based on the market cycle length you want to analyze.
- Smoothing Sample Size: (Default: 8) The period for the SuperSmoother filter. Adjust for desired responsiveness vs. smoothness.
Experiment with the settings to optimize for your trading style and timeframe!
Disclaimer: The Cosine-Self-Similarity indicator provides analytical insights but should be used in conjunction with other analysis methods and sound risk management practices. Past performance is not indicative of future results. Indicator is provided for statistical analysis and showing probabilities only and should not be construed as financial advice.
