OPEN-SOURCE SCRIPT
Updated Gold AI: Hyper-Frequency 1minute Scalper

The Gold AI: Hyper-Frequency is a high-precision scalping tool specifically engineered for the unique volatility of XAUUSD on lower timeframes (1m, 5m). Unlike traditional lagging indicators, this script utilizes a Lorentzian Distance Classifier—a machine learning approach that finds historical price fractals similar to current market conditions to predict the next high-probability move.
This indicator is designed for "Hyper-Frequency" trading, meaning it prioritizes capturing multiple micro-moves while using a three-stage Dynamic Take Profit system to let "runners" extend during strong momentum bursts.
█ THE AI CORE: LORENTZIAN CLASSIFICATION
Instead of standard Euclidean distance, this script employs Lorentzian Distance. This metric is superior for financial time series because it is less sensitive to extreme outliers, allowing the AI to identify patterns in "noisy" 1-minute gold charts that other models might miss.
The AI evaluates three key "features" to find matches: 1 — RSI (7): Momentum and overbought/oversold status. 2 — MFI (7): Money Flow Index to track institutional volume. 3 — ROC (3): Rate of Change to detect immediate velocity.
█ DYNAMIC PROFIT SCALING
To solve the "Gold Problem"—where price often spikes past targets or reverses instantly—we implemented a 3-Stage Profit Extender:
• Stage 1 (Initial TP): Targets a quick scalp (default 1.0 ATR). • Stage 2 (Extension): If momentum remains strong, the TP is automatically pushed further. The Stop Loss moves to Breakeven at this stage. • Stage 3 (Moonshot): For high-velocity moves, the TP extends to a major multiplier while the Stop Loss trails the previous candle's high/low.
█ KEY FEATURES
• K-Neighbors Engine: Analyzes the 'K' most similar historical instances to generate buy/sell "votes." • Sensitivity Control: Adjust how strictly the AI matches patterns. Lower values = higher accuracy; higher values = more frequent trades. • Volatility Filter (ATR): All targets and stops are mathematically pegged to current volatility, ensuring the script adapts whether the market is quiet or explosive. • Volume Gatekeeper: Filters out "fake-outs" that occur on low-volume retail spikes.
█ HOW TO USE
Asset: Optimized for XAUUSD (Gold).
Timeframe: Best performance on 1m or 5m charts.
Session: High-frequency signals are most reliable during London and New York sessions.
Confirmation: For maximum safety, enable the "Filter by 200 EMA" in settings to only take trades in the direction of the macro trend.
Disclaimer: Trading Gold involves high risk. This AI tool is designed to assist in decision-making and pattern recognition. Always perform your own due diligence and use proper risk management. Past performance does not guarantee future results.
This indicator is designed for "Hyper-Frequency" trading, meaning it prioritizes capturing multiple micro-moves while using a three-stage Dynamic Take Profit system to let "runners" extend during strong momentum bursts.
█ THE AI CORE: LORENTZIAN CLASSIFICATION
Instead of standard Euclidean distance, this script employs Lorentzian Distance. This metric is superior for financial time series because it is less sensitive to extreme outliers, allowing the AI to identify patterns in "noisy" 1-minute gold charts that other models might miss.
The AI evaluates three key "features" to find matches: 1 — RSI (7): Momentum and overbought/oversold status. 2 — MFI (7): Money Flow Index to track institutional volume. 3 — ROC (3): Rate of Change to detect immediate velocity.
█ DYNAMIC PROFIT SCALING
To solve the "Gold Problem"—where price often spikes past targets or reverses instantly—we implemented a 3-Stage Profit Extender:
• Stage 1 (Initial TP): Targets a quick scalp (default 1.0 ATR). • Stage 2 (Extension): If momentum remains strong, the TP is automatically pushed further. The Stop Loss moves to Breakeven at this stage. • Stage 3 (Moonshot): For high-velocity moves, the TP extends to a major multiplier while the Stop Loss trails the previous candle's high/low.
█ KEY FEATURES
• K-Neighbors Engine: Analyzes the 'K' most similar historical instances to generate buy/sell "votes." • Sensitivity Control: Adjust how strictly the AI matches patterns. Lower values = higher accuracy; higher values = more frequent trades. • Volatility Filter (ATR): All targets and stops are mathematically pegged to current volatility, ensuring the script adapts whether the market is quiet or explosive. • Volume Gatekeeper: Filters out "fake-outs" that occur on low-volume retail spikes.
█ HOW TO USE
Asset: Optimized for XAUUSD (Gold).
Timeframe: Best performance on 1m or 5m charts.
Session: High-frequency signals are most reliable during London and New York sessions.
Confirmation: For maximum safety, enable the "Filter by 200 EMA" in settings to only take trades in the direction of the macro trend.
Disclaimer: Trading Gold involves high risk. This AI tool is designed to assist in decision-making and pattern recognition. Always perform your own due diligence and use proper risk management. Past performance does not guarantee future results.
Release Notes
In this refined version of the Gold AI: Hyper-Frequency script, the primary addition is a Dynamic Trend Constraint designed to filter out low-probability trades during "noisy" market conditions on the 1m timeframe.Here is a breakdown of the specific additions:
1. EMA 55 Momentum Filter
The script now includes a 55-period Exponential Moving Average (EMA). This acts as a mid-term momentum threshold.
Long Condition: The AI only allows a Buy signal if the current price is strictly above the 55 EMA.
Short Condition: The AI only allows a Sell signal if the current price is strictly below the 55 EMA.
This ensures that the AI is not just identifying a historical pattern, but is also trading in sync with the immediate momentum of the market, which is critical for XAUUSD scalping.
2. Signal Confluence Logic
The logic in the Execution Logic section (Section 3) has been expanded. The script now cross-references three independent filters before firing an alert or drawing a label:
AI Consensus: (The Lorentzian Pattern Match)
Momentum Bias: (Price position relative to 55 EMA)
Trend Bias: (Optional 200 EMA filter, if enabled)
Volume Verification: (The Volume MA multiplier)
3. Integrated Alert System
We have added the alertcondition() engine at the bottom of the script. This creates dedicated hooks in the TradingView interface, allowing you to:
Receive Mobile Push Notifications for every verified AI entry.
Configure Email or Webhook alerts for automated trading.
Distinguish between Long and Short entries without needing to check the chart.
4. Yellow Visual Baseline
A yellow plot line representing the 55 EMA has been added to the chart. This provides immediate visual feedback. If you see an "AI START" label, you will notice it only appears on the "correct" side of this yellow line, providing a visual confirmation of why certain noisier signals are being suppressed.
Release Notes
Description of Changes: Fully Customizable AI EngineThe script has been upgraded from a static "fixed-logic" indicator to a fully editable trading tool. This change transforms how the AI interacts with the market by allowing you to control every internal parameter through the user interface.
What was changed?
Removal of EMA 55: The rigid 55-period filter was removed to restore the script’s "Hyper-Frequency" nature, giving you back full control over signal density.
Variable Parameter Integration: All core constants (RSI/MFI periods, AI lookback window, Volume thresholds, and ATR multipliers) were converted into Input Variables.
Organized Settings Menu: Inputs are now categorized into logical groups (AI Engine, Features, Execution, and Risk) for a professional and intuitive user experience.
Why was it changed?
Market Adaptability: Gold (XAUUSD) volatility changes significantly between the London and New York sessions. A fixed RSI(7) might work in the morning but fail in the afternoon; now you can adjust the "speed" of the AI’s eyes in seconds to match the current volatility.
User-Style Alignment: Some traders prefer "High Accuracy / Low Frequency" (requiring strict AI sensitivity), while others prefer "Scalp Volume" (requiring loose sensitivity). This update allows the script to serve both styles without needing to edit the code.
Future-Proofing: Financial markets are dynamic. By making the AI's "scan window" and feature periods editable, you can optimize the strategy over time as market behavior evolves, preventing the strategy from becoming "stale."
Summary of New Editable Functions
AI Scan Window: Change how far the AI looks back to find matching price patterns.
Feature Periods: Speed up or slow down the RSI, MFI, and ROC signals used for prediction.
Volume Gatekeeper: Define exactly how much volume is required to confirm an AI trade.
Risk Multipliers: Customize your Stop Loss and Take Profit distances based on your personal risk tolerance.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.