All indicators

AI Channels (Clustering)

By LuxAlgoAug 30, 2023

AI Channels (Clustering) is an indicator on Vela, our next-generation charting platform, written in Pine Script®.

Static chart image

AI Channels (Clustering) draws its channel from data, not formula. Rolling K-means clustering groups the last Window Size prices, and the centroids of the lowest and highest clusters become the lower and upper extremities, and the center line is drawn at their midpoint. Each extremity carries a dispersion area whose width mirrors how scattered prices are inside that cluster: a wide area is a volatile cluster, and price entering it has better odds of pushing clean through.

How to Trade the AI Channels (Clustering)?

  • Upper extremity break: price moving above it reads as an uptrend; dropping below the lower extremity reads as a downtrend.
  • Dispersion areas: treat a wide zone as a soft boundary. Price trading inside it raises the likelihood the extremity gives way.
  • As Trailing Stop: flip the display mode and the channel becomes a trailing stop that shadows the detected trend.
  • Tuning the read: larger Window Size values target longer-term trends, while more Clusters pushes the extremities further from price, making penetration rarer.

The default Denoise Channels option keeps the extremities steady for trend reading; disabling it plots the exact centroids at the cost of more irregular lines. Like the library's other machine learning tools, the clustering is compute-aware, with two performance inputs bounding the work per update.

AI Channels (Clustering) Settings

  • Window Size: how many recent prices feed the clustering.
  • Clusters: number of clusters detected within the window.
  • Denoise Channels: smoother extremities on, exact centroids off.
  • As Trailing Stop: switches the channel to trailing-stop display.
  • Maximum Iteration Steps: caps the centroid search. Faster loads, potentially rougher clustering.
  • Historical Bars Calculation: how many bars back the script computes.

Frequently Asked Questions

Free to use

Run it on Vela. Go further with a paid plan.

  • Up to 500 Custom Alerts, with webhook automation
  • Up to 10× the chart history of Free
  • Orderflow lookback up to full history
  • More Quant usage to customize it, plus extra usage when you need it
  • Futures data alongside crypto, stocks, forex and commodities
See plans

Also works on

TradingView
NinjaTrader
MetaTrader 4/5
Original indicatorBuilt in-house by LuxAlgo

Run it on Vela. Make it yours with Quant.

Open this indicator free on Vela, our next-generation charting platform. Then ask Quant, our coding agent built into Vela, to retune it or turn it into a backtested strategy of your own.