Skip to content
All library documents

Percentile-Based Clustering for Market Regime Analysis

Article TradingView scripts

Summary

This indicator creates two or three regime centers for selected technical features using lower and upper percentiles together with a running mean. Each observation is assigned to its nearest center. In a combined mode, selected features can be standardized with rolling z-scores and their distances fused, allowing a multi-feature regime view; individual feature modes are also available. An interpolated value visualizes proximity between centers, while alerts flag changes in the assigned regime.

The approach is designed as a deterministic, lower-compute alternative to iterative clustering, with the lookback setting trading responsiveness for smoother estimates. Users can adjust percentile boundaries, cluster count, and feature selection. The document explicitly distinguishes this heuristic from k-means and presents it as a tool for visualization or feature engineering, not a demonstrated trading edge. It gives no comparative study, out-of-sample evidence, or guidance for choosing parameters across assets and timeframes, so regime labels should be evaluated before being used in a trading system.

Key ideas

  • The method derives two or three centers from percentile thresholds and a running mean.
  • Observations are assigned to the closest center rather than updated through iterative k-means fitting.
  • Selected features can be standardized and combined to estimate a multi-feature regime.
  • Longer lookbacks favor smoother centers, while shorter lookbacks respond more quickly to changes.
  • The indicator provides regime visualization and alerts but no evidence of trading performance.

Tags

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