AI Adaptive Oscillator [PhenLabs]📊 Algorithmic Adaptive Oscillator
Version: PineScript™ v6
📌 Description
The AI Adaptive Oscillator is a sophisticated technical indicator that employs ensemble learning and adaptive weighting techniques to analyze market conditions. This innovative oscillator combines multiple traditional technical indicators through an AI-driven approach that continuously evaluates and adjusts component weights based on historical performance. By integrating statistical modeling with machine learning principles, the indicator adapts to changing market dynamics, providing traders with a responsive and reliable tool for market analysis.
🚀 Points of Innovation:
Ensemble learning framework with adaptive component weighting
Performance-based scoring system using directional accuracy
Dynamic volatility-adjusted smoothing mechanism
Intelligent signal filtering with cooldown and magnitude requirements
Signal confidence levels based on multi-factor analysis
🔧 Core Components
Ensemble Framework : Combines up to five technical indicators with performance-weighted integration
Adaptive Weighting : Continuous performance evaluation with automated weight adjustment
Volatility-Based Smoothing : Adapts sensitivity based on current market volatility
Pattern Recognition : Identifies potential reversal patterns with signal qualification criteria
Dynamic Visualization : Professional color schemes with gradient intensity representation
Signal Confidence : Three-tiered confidence assessment for trading signals
🔥 Key Features
The indicator provides comprehensive market analysis through:
Multi-Component Ensemble : Integrates RSI, CCI, Stochastic, MACD, and Volume-weighted momentum
Performance Scoring : Evaluates each component based on directional prediction accuracy
Adaptive Smoothing : Automatically adjusts based on market volatility
Pattern Detection : Identifies potential reversal patterns in overbought/oversold conditions
Signal Filtering : Prevents excessive signals through cooldown periods and minimum change requirements
Confidence Assessment : Displays signal strength through intuitive confidence indicators (average, above average, excellent)
🎨 Visualization
Gradient-Filled Oscillator : Color intensity reflects strength of market movement
Clear Signal Markers : Distinct bullish and bearish pattern signals with confidence indicators
Range Visualization : Clean representation of oscillator values from -6 to 6
Zero Line : Clear demarcation between bullish and bearish territory
Customizable Colors : Color schemes that can be adjusted to match your chart style
Confidence Symbols : Intuitive display of signal confidence (no symbol, +, or ++) alongside direction markers
📖 Usage Guidelines
⚙️ Settings Guide
Color Settings
Bullish Color
Default: #2b62fa (Blue)
This setting controls the color representation for bullish movements in the oscillator. The color appears when the oscillator value is positive (above zero), with intensity indicating the strength of the bullish momentum. A brighter shade indicates stronger bullish pressure.
Bearish Color
Default: #ce9851 (Amber)
This setting determines the color representation for bearish movements in the oscillator. The color appears when the oscillator value is negative (below zero), with intensity reflecting the strength of the bearish momentum. A more saturated shade indicates stronger bearish pressure.
Signal Settings
Signal Cooldown (bars)
Default: 10
Range: 1-50
This parameter sets the minimum number of bars that must pass before a new signal of the same type can be generated. Higher values reduce signal frequency and help prevent overtrading during choppy market conditions. Lower values increase signal sensitivity but may generate more false positives.
Min Change For New Signal
Default: 1.5
Range: 0.5-3.0
This setting defines the minimum required change in oscillator value between consecutive signals of the same type. It ensures that new signals represent meaningful changes in market conditions rather than minor fluctuations. Higher values produce fewer but potentially higher-quality signals, while lower values increase signal frequency.
AI Core Settings
Base Length
Default: 14
Minimum: 2
This fundamental setting determines the primary calculation period for all technical components in the ensemble (RSI, CCI, Stochastic, etc.). It represents the lookback window for each component’s base calculation. Shorter periods create a more responsive but potentially noisier oscillator, while longer periods produce smoother signals with potential lag.
Adaptive Speed
Default: 0.1
Range: 0.01-0.3
Controls how quickly the oscillator adapts to new market conditions through its volatility-adjusted smoothing mechanism. Higher values make the oscillator more responsive to recent price action but potentially more erratic. Lower values create smoother transitions but may lag during rapid market changes. This parameter directly influences the indicator’s adaptiveness to market volatility.
Learning Lookback Period
Default: 150
Minimum: 10
Determines the historical data range used to evaluate each ensemble component’s performance and calculate adaptive weights. This setting controls how far back the AI “learns” from past performance to optimize current signals. Longer periods provide more stable weight distribution but may be slower to adapt to regime changes. Shorter periods adapt more quickly but may overreact to recent anomalies.
Ensemble Size
Default: 5
Range: 2-5
Specifies how many technical components to include in the ensemble calculation.
Understanding The Interaction Between Settings
Base Length and Learning Lookback : The base length determines the reactivity of individual components, while the lookback period determines how their weights are adjusted. These should be balanced according to your timeframe - shorter timeframes benefit from shorter base lengths, while the lookback should generally be 10-15 times the base length for optimal learning.
Adaptive Speed and Signal Cooldown : These settings control sensitivity from different angles. Increasing adaptive speed makes the oscillator more responsive, while reducing signal cooldown increases signal frequency. For conservative trading, keep adaptive speed low and cooldown high; for aggressive trading, do the opposite.
Ensemble Size and Min Change : Larger ensembles provide more stable signals, allowing for a lower minimum change threshold. Smaller ensembles might benefit from a higher threshold to filter out noise.
Understanding Signal Confidence Levels
The indicator provides three distinct confidence levels for both bullish and bearish signals:
Average Confidence (▲ or ▼) : Basic signal that meets the minimum pattern and filtering criteria. These signals indicate potential reversals but with moderate confidence in the prediction. Consider using these as initial alerts that may require additional confirmation.
Above Average Confidence (▲+ or ▼+) : Higher reliability signal with stronger underlying metrics. These signals demonstrate greater consensus among the ensemble components and/or stronger historical performance. They offer increased probability of successful reversals and can be traded with less additional confirmation.
Excellent Confidence (▲++ or ▼++) : Highest quality signals with exceptional underlying metrics. These signals show strong agreement across oscillator components, excellent historical performance, and optimal signal strength. These represent the indicator’s highest conviction trade opportunities and can be prioritized in your trading decisions.
Confidence assessment is calculated through a multi-factor analysis including:
Historical performance of ensemble components
Degree of agreement between different oscillator components
Relative strength of the signal compared to historical thresholds
✅ Best Use Cases:
Identify potential market reversals through oscillator extremes
Filter trade signals based on AI-evaluated component weights
Monitor changing market conditions through oscillator direction and intensity
Confirm trade signals from other indicators with adaptive ensemble validation
Detect early momentum shifts through pattern recognition
Prioritize trading opportunities based on signal confidence levels
Adjust position sizing according to signal confidence (larger for ++ signals, smaller for standard signals)
⚠️ Limitations
Requires sufficient historical data for accurate performance scoring
Ensemble weights may lag during dramatic market condition changes
Higher ensemble sizes require more computational resources
Performance evaluation quality depends on the learning lookback period length
Even high confidence signals should be considered within broader market context
💡 What Makes This Unique
Adaptive Intelligence : Continuously adjusts component weights based on actual performance
Ensemble Methodology : Combines strength of multiple indicators while minimizing individual weaknesses
Volatility-Adjusted Smoothing : Provides appropriate sensitivity across different market conditions
Performance-Based Learning : Utilizes historical accuracy to improve future predictions
Intelligent Signal Filtering : Reduces noise and false signals through sophisticated filtering criteria
Multi-Level Confidence Assessment : Delivers nuanced signal quality information for optimized trading decisions
🔬 How It Works
The indicator processes market data through five main components:
Ensemble Component Calculation :
Normalizes traditional indicators to consistent scale
Includes RSI, CCI, Stochastic, MACD, and volume components
Adapts based on the selected ensemble size
Performance Evaluation :
Analyzes directional accuracy of each component
Calculates continuous performance scores
Determines adaptive component weights
Oscillator Integration :
Combines weighted components into unified oscillator
Applies volatility-based adaptive smoothing
Scales final values to -6 to 6 range
Signal Generation :
Detects potential reversal patterns
Applies cooldown and magnitude filters
Generates clear visual markers for qualified signals
Confidence Assessment :
Evaluates component agreement, historical accuracy, and signal strength
Classifies signals into three confidence tiers (average, above average, excellent)
Displays intuitive confidence indicators (no symbol, +, ++) alongside direction markers
💡 Note:
The AI Adaptive Oscillator performs optimally when used with appropriate timeframe selection and complementary indicators. Its adaptive nature makes it particularly valuable during changing market conditions, where traditional fixed-weight indicators often lose effectiveness. The ensemble approach provides a more robust analysis by leveraging the collective intelligence of multiple technical methodologies. Pay special attention to the signal confidence indicators to optimize your trading decisions - excellent (++) signals often represent the most reliable trade opportunities.
Artificialintelligence
QT RSI [ W.ARITAS ]The QT RSI is an innovative technical analysis indicator designed to enhance precision in market trend identification and decision-making. Developed using advanced concepts in quantum mechanics, machine learning (LSTM), and signal processing, this indicator provides actionable insights for traders across multiple asset classes, including stocks, crypto, and forex.
Key Features:
Dynamic Color Gradient: Visualizes market conditions for intuitive interpretation:
Green: Strong buy signal indicating bullish momentum.
Blue: Neutral or observation zone, suggesting caution or lack of a clear trend.
Red: Strong sell signal indicating bearish momentum.
Quantum-Enhanced RSI: Integrates adaptive energy levels, dynamic smoothing, and quantum oscillators for precise trend detection.
Hybrid Machine Learning Model: Combines LSTM neural networks and wavelet transforms for accurate prediction and signal refinement.
Customizable Settings: Includes advanced parameters for dynamic thresholds, sensitivity adjustment, and noise reduction using Kalman and Jurik filters.
How to Use:
Interpret the Color Gradient:
Green Zone: Indicates bullish conditions and potential buy opportunities. Look for upward momentum in the RSI plot.
Blue Zone: Represents a neutral or consolidation phase. Monitor the market for trend confirmation.
Red Zone: Indicates bearish conditions and potential sell opportunities. Look for downward momentum in the RSI plot.
Follow Overbought/Oversold Boundaries:
Use the upper and lower RSI boundaries to identify overbought and oversold conditions.
Leverage Advanced Filtering:
The smoothed signals and quantum oscillator provide a robust framework for filtering false signals, making it suitable for volatile markets.
Application: Ideal for traders and analysts seeking high-precision tools for:
Identifying entry and exit points.
Detecting market reversals and momentum shifts.
Enhancing algorithmic trading strategies with cutting-edge analytics.
Machine Learning Moving Average [LuxAlgo]The Machine Learning Moving Average (MLMA) is a responsive moving average making use of the weighting function obtained Gaussian Process Regression method. Characteristic such as responsiveness and smoothness can be adjusted by the user from the settings.
The moving average also includes bands, used to highlight possible reversals.
🔶 USAGE
The Machine Learning Moving Average smooths out noisy variations from the price, directly estimating the underlying trend in the price.
A higher "Window" setting will return a longer-term moving average while increasing the "Forecast" setting will affect the responsiveness and smoothness of the moving average, with higher positive values returning a more responsive moving average and negative values returning a smoother but less responsive moving average.
Do note that an excessively high "Forecast" setting will result in overshoots, with the moving average having a poor fit with the price.
The moving average color is determined according to the estimated trend direction based on the bands described below, shifting to blue (default) in an uptrend and fushia (default) in downtrends.
The upper and lower extremities represent the range within which price movements likely fluctuate.
Signals are generated when the price crosses above or below the band extremities, with turning points being highlighted by colored circles on the chart.
🔶 SETTINGS
Window: Calculation period of the moving average. Higher values yield a smoother average, emphasizing long-term trends and filtering out short-term fluctuations.
Forecast: Sets the projection horizon for Gaussian Process Regression. Higher values create a more responsive moving average but will result in more overshoots, potentially worsening the fit with the price. Negative values will result in a smoother moving average.
Sigma: Controls the standard deviation of the Gaussian kernel, influencing weight distribution. Higher Sigma values return a longer-term moving average.
Multiplicative Factor: Adjusts the upper and lower extremity bounds, with higher values widening the bands and lowering the amount of returned turning points.
🔶 RELATED SCRIPTS
Machine-Learning-Gaussian-Process-Regression
SuperTrend-AI-Clustering
Machine Learning using Neural Networks | EducationalThe script provided is a comprehensive illustration of how to implement and execute a simplistic Neural Network (NN) on TradingView using PineScript.
It encompasses the entire workflow from data input, weight initialization, implicit neuron calculation, feedforward computation, backpropagation for weight adjustments, generating predictions, to visualizing the Mean Squared Error (MSE) Loss Curve for monitoring the training phase.
In the visual example above, you can see that the prediction is not aligned with the actual value. This is intentional for demonstrative purposes, and by incrementing the Epochs or Learning Rate, you will see these two values converge as the accuracy increases.
Hyperparameters:
Learning Rate, Epochs, and the choice between Simple Backpropagation and a verbose version are declared as script inputs, allowing users to tailor the training process.
Initialization:
Random initialization of weight matrices (w1, w2) is performed to ensure asymmetry, promoting effective gradient updates. A seed is added for reproducibility.
Utility Functions:
Functions for matrix randomization, sigmoid activation, MSE loss calculation, data normalization, and standardization are defined to streamline the computation process.
Neural Network Computation:
The feedforward function computes the hidden and output layer values given the input.
Two variants of the backpropagation function are provided for weight adjustment, with one offering a more verbose step-by-step computation of gradients.
A wrapper train_nn function iterates through epochs, performing feedforward, loss computation, and backpropagation in each epoch while logging and collecting loss values.
Training Invocation:
The input data is prepared by normalizing it to a value between 0 and 1 using the maximum standardized value, and the training process is invoked only on the last confirmed bar to preserve computational resources.
Output Forecasting and Visualization:
Post training, the NN's output (predicted price) is computed, standardized and visualized alongside the actual price on the chart.
The MSE loss between the predicted and actual prices is visualized, providing insight into the prediction accuracy.
Optionally, the MSE Loss Curve is plotted on the chart, illustrating the loss trajectory through epochs, assisting in understanding the training performance.
Customizable Visualization:
Various inputs control visualization aspects like Chart Scaling, Chart Horizontal Offset, and Chart Vertical Offset, allowing users to adapt the visualization to their preference.
-------------------------------------------------------
The following is this Neural Network structure, consisting of one hidden layer, with two hidden neurons.
Through understanding the steps outlined in my code, one should be able to scale the NN in any way they like, such as changing the input / output data and layers to fit their strategy ideas.
Additionally, one could forgo the backpropagation function, and load their own trained weights into the w1 and w2 matrices, to have this code run purely for inference.
-------------------------------------------------------
While this demonstration does create a “prediction”, it is on historical data. The purpose here is educational, rather than providing a ready tool for non-programmer consumers.
Normally in Machine Learning projects, the training process would be split into two segments, the Training and the Validation parts. For the purpose of conveying the core concept in a concise and non-repetitive way, I have foregone the Validation part. However, it is merely the application of your trained network on new data (feedforward), and monitoring the loss curve.
Essentially, checking the accuracy on “unseen” data, while training it on “seen” data.
-------------------------------------------------------
I hope that this code will help developers create interesting machine learning applications within the Tradingview ecosystem.