All indicators

Machine Learning RSI

Nov 12, 2024

Static chart image
SignalsOscillatorsMachine LearningMoving Averages

The Machine Learning RSI indicator combines the Relative Strength Index (RSI) with machine learning clustering techniques to provide dynamic, adaptive overbought and oversold thresholds. By replacing static levels with data-driven clusters, this tool helps traders identify momentum shifts and market reversals that account for current market volatility and historical behavior.

Usage

The Usage section describes how the script can be used to identify market regimes and potential trade entries. Unlike a standard RSI that uses fixed 70/30 levels, this indicator uses three clusters to define the current state of momentum.

  • Long Signals: A bullish signal is typically identified when the RSI line crosses above the upper dynamic threshold (Cluster 3 centroid), suggesting strong upward momentum.
  • Short Signals: A bearish signal is typically identified when the RSI line falls below the lower dynamic threshold (Cluster 1 centroid), suggesting increasing downward pressure.
  • Neutral Zones: When the RSI oscillates between the upper and lower thresholds (often associated with Cluster 2), the market is considered to be in a mid-range or neutral state.

Traders can utilize the smoothing options to filter out market noise. For example, using a "Hull" or "EMA" smoothing type can provide a more responsive or smoother RSI line, respectively, which can help in trending markets to avoid premature exits.

Details

The script utilizes a percentile-based initialization followed by an iterative clustering optimization process. It categorizes historical RSI data into three distinct groups:

  • Cluster 1: Low RSI values representing oversold or bearish conditions.
  • Cluster 2: Mid-range RSI values representing consolidation or transition.
  • Cluster 3: High RSI values representing overbought or bullish conditions.

The "Long Threshold" is derived from the upper centroid of Cluster 3, while the "Short Threshold" is derived from the lower centroid of Cluster 1. This iterative approach ensures that as market volatility expands or contracts, the thresholds expand or contract accordingly, maintaining the statistical significance of the overbought and oversold levels.

Settings

Relative Strength Index

  • Calculation Source: Determines the price data used for the RSI (e.g., Close, Open, HL2).
  • RSI Length: The lookback period for the RSI calculation.
  • Smooth RSI?: Enables or disables smoothing of the raw RSI value.
  • Moving Average Type: Selects the smoothing algorithm (SMA, EMA, WMA, HMA, DEMA, TEMA, ALMA, T3, etc.).
  • Smoothing Period: The lookback period for the selected moving average.
  • Sigma for ALMA: Specific offset parameter used only when the ALMA smoothing type is selected.

Machine Learning Thresholds

  • Threshold Range Min/Max: Sets the boundaries for the percentile-based clustering.
  • Step: Defines the granularity of the factor calculation.

ML Optimization

  • Performance Memory: Controls the weighting of historical data; higher values result in smoother threshold adjustments.
  • Max Clustering Steps: The maximum number of iterations the clustering algorithm performs to find centroids.
  • Max Data Points: Limits the historical data buffer to optimize script performance.

UI Settings

  • Show Threshold Lines?: Toggles the visibility of the dynamic ML thresholds.
  • Color Bars According to Trend?: Changes the chart's candle colors based on the RSI's position relative to thresholds.
  • Signal Line Width: Adjusts the thickness of the main RSI plot.
  • Color Pickers: Customizes the colors for Long, Short, and Neutral conditions.

FAQ

How do the dynamic thresholds differ from standard RSI levels?
Standard RSI uses fixed levels (like 70 and 30) regardless of market conditions. This tool uses machine learning to cluster recent data, meaning the thresholds will rise in strong uptrends and fall in strong downtrends, preventing "premature" overbought or oversold signals.

Which smoothing method is best for the RSI?
It depends on your strategy. EMA and SMA are standard for general filtering, while Hull (HMA) or ALMA provide lower lag, which may be more effective for fast-moving scalp trades or day trading.

How do I access the Machine Learning RSI?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.