OPEN-SOURCE SCRIPT
Quantum Pulse AI

High-Level Overview
This script is a hybrid trading system that combines traditional trend-following indicators with a k-Nearest Neighbors (k-NN) Machine Learning engine. Instead of relying solely on hardcoded crossovers, it looks at the current market conditions, searches its historical memory for similar moments, and predicts the next move based on what happened in the past.
1. The Technical Foundation (Base Features)
Before the AI even kicks in, the script tracks a robust baseline of institutional-grade metrics:
Moving Averages: Two customizable MAs (SMA/EMA/VWMA) determine short-term momentum.
VWAP & Bands: Anchored daily VWAP with up to 3 standard deviation bands to judge institutional value and overbought/oversold extremes.
Trend Smoothing: Hull Moving Average (HMA) and Supertrend dictate the broader directional bias.
Momentum Filters: ADX ensures the market is actually trending (ignoring chop), while relative volume tracks participation.
2. The AI k-NN Classification Engine
This is the "brain" of the script. It uses a mathematical algorithm to predict price direction based on Euclidean geometry.
Feature Vectors: It takes 4 real-time data points (MA spread, Price vs. VWAP, HMA slope, and Relative Volume) and normalizes them into a 4-dimensional spatial grid.
Historical Scanning: The script looks back in time (e.g., 2,000 bars) and calculates the exact geometric distance between the current market conditions and historical market conditions.
Voting System: It isolates the k closest historical matches (e.g., the 8 most similar moments in the past). It then looks at what price actually did next in those historical moments (went up or went down). Those neighbors "vote" on the current probability, generating a Bull/Bear Confidence Percentage.
3. Signal Filtering & State Tracking (Anti-Flicker)
The script includes strict logic to prevent chart clutter and false signals:
Convergence: A signal will only fire if the AI probability is above your defined threshold (e.g., 70%), the ADX shows a strong trend, and price is structurally on the correct side of the VWAP.
State Tracker: A built-in memory state (currentTradeState) forces strict alternation. Once an "AI BUY" fires, the system locks into a Long state. It will ignore any duplicate bullish spikes and will only fire again when an "AI SELL" conditions are met.
4. Dashboards & UI
Core Dashboard: A bottom-center panel that gives a rapid visual summary of all traditional metrics (Price, VWAP, MA, HMA, ST, ADX, Volume).
ML Ensemble Panel: A top-right heads-up display showing the AI's exact live confidence percentages, its grading scale (A+, A, B, C), and the current active forecast.
Day Trading Extras: Automatically plots Previous Day High/Low/Close, daily Pivot points, Support/Resistance levels, and the critical First 15-Minute High/Low breakout zones.
This script is a hybrid trading system that combines traditional trend-following indicators with a k-Nearest Neighbors (k-NN) Machine Learning engine. Instead of relying solely on hardcoded crossovers, it looks at the current market conditions, searches its historical memory for similar moments, and predicts the next move based on what happened in the past.
1. The Technical Foundation (Base Features)
Before the AI even kicks in, the script tracks a robust baseline of institutional-grade metrics:
Moving Averages: Two customizable MAs (SMA/EMA/VWMA) determine short-term momentum.
VWAP & Bands: Anchored daily VWAP with up to 3 standard deviation bands to judge institutional value and overbought/oversold extremes.
Trend Smoothing: Hull Moving Average (HMA) and Supertrend dictate the broader directional bias.
Momentum Filters: ADX ensures the market is actually trending (ignoring chop), while relative volume tracks participation.
2. The AI k-NN Classification Engine
This is the "brain" of the script. It uses a mathematical algorithm to predict price direction based on Euclidean geometry.
Feature Vectors: It takes 4 real-time data points (MA spread, Price vs. VWAP, HMA slope, and Relative Volume) and normalizes them into a 4-dimensional spatial grid.
Historical Scanning: The script looks back in time (e.g., 2,000 bars) and calculates the exact geometric distance between the current market conditions and historical market conditions.
Voting System: It isolates the k closest historical matches (e.g., the 8 most similar moments in the past). It then looks at what price actually did next in those historical moments (went up or went down). Those neighbors "vote" on the current probability, generating a Bull/Bear Confidence Percentage.
3. Signal Filtering & State Tracking (Anti-Flicker)
The script includes strict logic to prevent chart clutter and false signals:
Convergence: A signal will only fire if the AI probability is above your defined threshold (e.g., 70%), the ADX shows a strong trend, and price is structurally on the correct side of the VWAP.
State Tracker: A built-in memory state (currentTradeState) forces strict alternation. Once an "AI BUY" fires, the system locks into a Long state. It will ignore any duplicate bullish spikes and will only fire again when an "AI SELL" conditions are met.
4. Dashboards & UI
Core Dashboard: A bottom-center panel that gives a rapid visual summary of all traditional metrics (Price, VWAP, MA, HMA, ST, ADX, Volume).
ML Ensemble Panel: A top-right heads-up display showing the AI's exact live confidence percentages, its grading scale (A+, A, B, C), and the current active forecast.
Day Trading Extras: Automatically plots Previous Day High/Low/Close, daily Pivot points, Support/Resistance levels, and the critical First 15-Minute High/Low breakout zones.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。