All indicators

AI SuperTrend x Pivot Percentile - Strategy

Jan 28, 2024

Static chart image
SignalsMachine LearningMoving AveragesVolatility

The AI SuperTrend x Pivot Percentile indicator is a strategy tool that integrates K-Nearest Neighbors (KNN) machine learning with traditional trend-following mechanics to enhance market entry accuracy. By combining AI-driven SuperTrend predictions with Pivot Percentile strength analysis, the tool identifies high-probability trend continuations while filtering out market noise.

Usage

The Usage section describes how the script can be used to identify market trends and execute trades based on synchronized signals.

The strategy generates signals based on the confluence of two primary components:

  • Trend Identification: The AI-enhanced SuperTrend uses the KNN algorithm to classify the current market direction as bullish or bearish based on historical price behavior.
  • Trend Strength Validation: The Pivot Percentile analysis evaluates the strength of the trend by calculating percentile ranks for highs and lows.

A Long signal is triggered when the AI SuperTrend indicates a bullish direction and the Pivot Percentile analysis confirms bullish strength. A Short signal is triggered when both components indicate a bearish direction and strength. Traders can utilize the dynamic trailing stop-loss, which is automatically adjusted based on the SuperTrend bands, to manage risk.

Details

The script's execution is built upon several advanced technical concepts:

  • KNN Algorithm: Unlike standard SuperTrends that rely solely on current ATR and price, this script uses the K-Nearest Neighbors algorithm. It measures the "distance" between current data points and historical patterns to predict the most likely trend direction.
  • Pivot Percentiles: This component calculates the rank of current prices relative to historical highs and lows over multiple time lengths. It serves as a secondary filter to ensure that signals are only generated when the price is showing significant momentum.
  • Multi-TF Integration: The strategy allows for calculations based on higher timeframes (HTF), providing a macro perspective even when trading on lower timeframe charts.
  • ADX/DMI Filter: To avoid "choppy" or sideways markets, the strategy includes an Average Directional Index (ADX) filter. This ensures trades are only taken when a trend is sufficiently strong.

Settings

The settings are categorized to allow for fine-tuning of the AI and technical components:

  • Trade Setup
    • Select Trading Direction: Choose between "Long", "Short", or "Both" to align with your bias.
  • AI Settings
    • Neighbors (K): The number of historical neighbors the KNN algorithm considers. Low values increase sensitivity; high values increase smoothness.
    • Data Points: The total historical lookback period for the AI model.
  • Super Trend Settings
    • Higher Time Frame (1st & 2nd): The timeframes used for the dual SuperTrend calculation.
    • Length: The lookback period for the ATR and Moving Average.
    • Factor: The multiplier that determines the width of the SuperTrend bands.
    • MA Source: The type of Moving Average used (SMA, EMA, WMA, RMA, VWMA).
  • AI Trend Prediction
    • Price/Prediction Trend: Lengths for the weighted moving averages used in AI classification.
  • Pivot Percentile Settings
    • Length for Pivot Percentile: The base lookback for calculating price percentiles.
  • ADX and DMI Settings
    • ADX Length: Lookback period for trend strength calculation.
    • Time Frame for ADX: The timeframe used specifically for the strength filter.
    • Use ADX and DMI Filter?: Toggles the requirement for a strong trend before entering trades.

FAQ

How do the AI settings affect the signals? Adjusting the "Neighbors" and "Data Points" determines how the KNN algorithm interprets history. A lower number of neighbors makes the strategy more responsive to recent volatility, while more data points provide a more stable, long-term trend outlook.

What is the purpose of the dual SuperTrend settings? The script uses two separate SuperTrend calculations (often on different timeframes) to ensure that entry signals are supported by both short-term momentum and long-term trend direction.

How do I access this tool? How to access AI SuperTrend x Pivot Percentile? 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.