Skip to main content

SuperTrend AI Clustering (SAIC): How the Self-Tuning Indicator Works

How Sahi's K-means clustering picks the best-performing SuperTrend factor for you — and how to trade its signals.

Revati Krishna
Published: 2 Jul 2026, 05:30 PM IST (1 week ago)
Last Updated: 3 Jul 2026, 01:18 PM IST (1 week ago)
10 min read

Quick Answer

SuperTrend AI Clustering (SAIC) is a self-tuning SuperTrend. It tests many ATR multipliers at once and uses a K-means algorithm to pick the best-performing one, so you do not have to guess a fixed factor. On the chart, a teal trailing stop means the trend is bullish and a red one means bearish; a smoother AMA line confirms the direction, and labels print a performance score (higher is stronger). Trade fresh, high-scored flips where both lines agree. It is free on Sahi, with no subscription required.

Overview

SuperTrend AI Clustering runs many SuperTrend calculations in parallel — each with a different ATR multiplier (factor) across a user-defined range — and then uses a K-means clustering algorithm to sort those factor variants into three performance groups: Best, Average, and Worst. It picks the factor from your chosen cluster (default: Best) to drive the final trailing stop. The result is a SuperTrend line that self-tunes to whichever multiplier has been performing best on the current instrument and timeframe, rather than requiring you to guess a single fixed factor.

On the Sahi chart it draws two overlaid lines: a Trailing Stop line that flips between teal (bullish) and red (bearish) as trend changes, and a smoother Trailing Stop AMA line (an adaptive moving average of the stop) that confirms the same direction at a gentler slope. When signals are enabled, small labelled dots appear at each trend flip. Candle bars optionally shade in gradient colour reflecting the cluster's current performance score. A dashboard table in the corner shows the three clusters' sizes, centroid dispersions, and the factor values assigned to each cluster.

How to Read the Indicator

Trailing Stop Line

The main line plots directly on the price chart as either teal or red depending on the current trend direction:

  • Teal (below price): trend is bullish — the line acts as a rising support floor. Price staying above it means the uptrend is intact.
  • Red (above price): trend is bearish — the line acts as a falling resistance ceiling. Price staying below it means the downtrend is intact.

The line is suppressed (shows na) for the one bar of the flip itself, so you will see a tiny visual gap exactly at each crossover — that gap marks the transition. Treat a fresh teal flip as a potential long trigger and a fresh red flip as a potential short trigger, but wait for the bar to close before acting.

Trailing Stop AMA (Adaptive Moving Average)

A second, smoother line plots alongside the main stop. It uses the cluster's performance index as its adaptive smoothing coefficient — when performance is strong the AMA tracks the stop tightly; when performance is weak it lags more:

  • Teal (semi-transparent, below price): bullish confirmation.
  • Red (semi-transparent, above price): bearish confirmation.

The AMA is hidden at any bar where price crosses through it, again marking the flip point clearly. Use this line as a secondary filter: if both the Trailing Stop and the AMA agree on direction, the signal is higher quality. If they diverge (the AMA has not yet flipped), treat the main stop flip as early and wait.

Buy / Sell Signal Labels

When "Show Signals" is on, a small label appears at every trend flip, anchored to the trailing stop price:

  • Teal label pointing up: bullish flip — price has crossed above the stop, trend turned long.
  • Red label pointing down: bearish flip — price has crossed below the stop, trend turned short.

The number printed inside each label is the performance index score × 10 (an integer, e.g. 7 means a raw score of about 0.7). A higher number means the Best-cluster factor was performing more decisively at the moment of the flip — treat higher-scored labels as stronger signals and lower-scored ones (1–2) with more caution.

Candle Gradient Colouring

When "Candle Coloring" is on, every bar is shaded using a gradient from a faint tint (low performance) to the full teal or red (high performance). This gives you a running visual of how confidently the best-cluster factor is trending:

  • Rich, saturated teal/red candles: high performance score — trend is behaving cleanly.
  • Pale, washed-out candles: low performance score — trend signal is weak or the market is choppy.

In a strong directional move candles will deepen in colour as momentum builds. Fading candle colour during a trend is an early warning that the move may be exhausting.

Dashboard Table

A small dark table (4 rows × 4 columns) shows the K-means clustering output at the most recent bar:

  • Cluster column headers: Best / Average / Worst — sorted by performance (Best = highest-performing factor group).
  • Size row: how many factor variants were assigned to each cluster this bar. A large Best cluster means many factor variants are all performing similarly well — a more reliable signal. A small Best cluster (1–2 factors) means the indicator has found a very specific sweet spot.
  • Centroid Dispersion row: average distance of cluster members from their centroid. Lower dispersion means tighter agreement within the cluster — more confident selection.
  • Factors row: the exact ATR multiplier values assigned to each cluster. This is informational — it tells you which factor range is currently winning.

If the Best cluster's factor values are clustered tightly (e.g. 2.5, 3.0, 3.5) and dispersion is low, the self-tuning is stable. If Best keeps jumping to extreme values (e.g. 0.5 or 5.0), treat signals with extra care.

Example Scenarios

Scenario 1 — SuperTrend flips teal, buy a CE (bullish)

Nifty is trading around 24,860 and has been in a choppy sideways range. The SuperTrend line is red (above price). On the 15-minute chart a strong green candle closes well above the trailing stop; the line flips to teal, appearing below price, and a teal label prints with a score of 8 — high performance. The AMA also flips teal on the same bar confirming the move. Candle colouring immediately shows rich teal bars.

  • What you do: buy 1 lot of Nifty 24,900 CE at a premium of about ₹105.
  • Stop loss: if the Trailing Stop line flips back to red (price closes below the stop), exit. At that point, with Nifty back near 24,820, the CE premium would be around ₹65 — risk of roughly ₹40 per unit.
  • Target: the recent swing high near 25,000. CE premium near that level would be approximately ₹155.
  • Why it works: both the main stop and the AMA confirm the flip, the performance score is high, and candle colouring validates genuine momentum rather than a low-quality whipsaw.

Scenario 2 — SuperTrend flips red, buy a PE (bearish)

Nifty has been grinding upward and is near 25,080. On the 15-minute chart a sharp red candle closes below the trailing stop; the line flips from teal to red (appearing above price) with a label showing a score of 7. The AMA lags by one bar but then also flips red on the next candle. Candle colours shade a deep red, confirming strong bearish momentum.

  • What you do: buy 1 lot of Nifty 25,100 PE at a premium of about ₹120.
  • Stop loss: if the Trailing Stop line flips back to teal, exit. With Nifty reclaiming 25,120 the PE premium would be around ₹80 — risk of roughly ₹40 per unit.
  • Target: pullback toward 24,980, where the PE premium would be approximately ₹170.
  • Why it works: the bearish flip is confirmed by both lines and the high score means the best-performing cluster factor agrees decisively — not a marginal crossover.

Scenario 3 — What to avoid

  • Do not act on a low-score label (1–3). A label score of 1 or 2 means the Best-cluster factor had very weak performance at the flip — the crossover is happening in noise, not a clean trend. These are the most common false signals; skip them entirely or wait for the next higher-scored flip.
  • Do not trade when the AMA and the Trailing Stop contradict each other. If the main stop flipped teal but the AMA is still red, the trend change has not been confirmed. The AMA lagging is the indicator's own built-in warning — respect it.
  • Do not trade washed-out candle colours on a flip. If candle colouring is enabled and the bar at the flip is pale and faint (low performance index), the best cluster has almost no edge at that moment. Rich colour = confidence; pale colour = skip.
  • Be cautious around major events. News-driven spikes can cause the trailing stop to flip back and forth within minutes, generating multiple low-score signals in a row. Suspend trading the indicator around RBI announcements, budget events, or global data releases.

Settings Panel Guide

General (top-level inputs)

  • ATR Length: number of bars used to calculate Average True Range, which sets the sensitivity of the trailing stop. Default is 10. A smaller value (e.g. 7) makes the stop react faster to volatility — more flips, more noise. A larger value (e.g. 14–20) smooths it out — fewer, slower flips. For Nifty / BankNifty 15-minute intraday, 10 is a reliable starting point.
  • Factor Range (Min and Max): the lowest and highest ATR multiplier values to test. Defaults are 1 (min) and 5 (max). The algorithm tries every factor from Min to Max in increments of Step. Widening the range (e.g. 0.5–8) gives the clustering more options to find the true best factor but increases computation time. Narrowing it (e.g. 2–4) focuses the search around a specific zone.
  • Step: the increment between factor values tested within the range. Default is 0.5. Smaller steps (e.g. 0.25) create more factor candidates for finer-grained clustering — slower to compute. Larger steps (e.g. 1.0) are faster but coarser.
  • Performance Memory: the EMA length used to track each factor's recent performance score. Default is 10. A lower value (e.g. 5) makes the indicator respond faster to recent performance shifts — adapts quickly but can be jumpy. A higher value (e.g. 20–30) gives a more stable, slower-updating selection. For intraday use 10; for daily/weekly charts consider 20.
  • From Cluster: which of the three K-means clusters to use as the source of the final trailing stop factor. Default is Best. Options: Best (highest-performing — most aggressive), Average (middle cluster — moderate), Worst (lowest-performing — most conservative). For options trading on intraday Nifty, stick with Best. Use Average if you find Best generates too many whipsaws on your timeframe.

Optimization

  • Maximum Iteration Steps: how many K-means iterations the algorithm is allowed to run per bar. Default is 1000. In practice the algorithm converges well before this limit on most datasets. No need to change this unless you see performance warnings.
  • Historical Bars Calculation: how many bars back from the current bar are included in the clustering. Default is 10000. Reducing this (e.g. 2000) limits computation to more recent data only — useful on very long chart histories if the script is slow. For standard intraday use, leave as default.

Style

  • Trailing Stop (bearish and bullish swatches): the colour of the main trailing stop line. Defaults are red (bearish) and teal (bullish). Cosmetic only.
  • AMA (bearish and bullish swatches): the colour of the adaptive moving average line. Defaults are semi-transparent red and semi-transparent teal. Cosmetic only.
  • Candle Coloring: toggle to shade chart bars using a gradient based on the current performance index. Default is on. Turn off for a cleaner chart if you find the colouring distracting; the trailing stop lines carry the same information.
  • Show Signals: toggle to show or hide the buy/sell flip labels with performance scores. Default is on. Disable if you only want the lines without the label clutter.

Dashboard

  • Show Dashboard: toggle the clustering stats table on or off. Default is on. Useful to keep visible when first learning the indicator — once you are comfortable with how the clusters behave you can hide it.
  • Location: where on the chart the dashboard table appears. Default is Top Right. Options: Top Right, Bottom Right, Bottom Left. Move it to avoid overlap with other indicators or the price scale.
  • Size: font/cell size of the dashboard table. Default is Small. Options: Tiny, Small, Normal. Use Tiny on smaller screen layouts.

Frequently Asked Questions (FAQs)

All topics