PROTECTED SOURCE SCRIPT
MACD + 200 EMA + Chandelier + ML Optimizer

Neural MACD Trend Strategy [ML + Chandelier + ADX]
This script modernizes a classic high-probability trend strategy by integrating Machine Learning and dynamic risk management. It is built on the foundation of the 9, 21, and 200 EMAs with MACD execution, designed to automate the workflow of trend traders.
Key Features:
1. Core Logic: Trades are executed on MACD crosses, but only when aligned with the long-term trend (200 EMA). An optional setting enforces a simultaneous 9/21 EMA cross for high-momentum confirmation.
2. Machine Learning Optimizer: A K-Nearest Neighbors (KNN) algorithm runs in the background, analyzing RSI, CCI, and ROC. It compares the current setup to the last 1,000 bars of history; if the historical probability is negative, the ML blocks the trade to save capital.
3. Range Filter: Uses ADX to detect choppy markets. If the market is ranging (ADX < 20), the background turns gray and trading is paused.
4. Advanced Exits: Automatically calculates Stop Losses based on recent Swing Highs/Lows. Includes a Chandelier Exit (ATR Trailing Stop) to lock in profits dynamically. You can choose between fixed Reward-to-Risk targets (e.g., 1.5x) or disable targets to ride the trend until the trailing stop is hit.
This script modernizes a classic high-probability trend strategy by integrating Machine Learning and dynamic risk management. It is built on the foundation of the 9, 21, and 200 EMAs with MACD execution, designed to automate the workflow of trend traders.
Key Features:
1. Core Logic: Trades are executed on MACD crosses, but only when aligned with the long-term trend (200 EMA). An optional setting enforces a simultaneous 9/21 EMA cross for high-momentum confirmation.
2. Machine Learning Optimizer: A K-Nearest Neighbors (KNN) algorithm runs in the background, analyzing RSI, CCI, and ROC. It compares the current setup to the last 1,000 bars of history; if the historical probability is negative, the ML blocks the trade to save capital.
3. Range Filter: Uses ADX to detect choppy markets. If the market is ranging (ADX < 20), the background turns gray and trading is paused.
4. Advanced Exits: Automatically calculates Stop Losses based on recent Swing Highs/Lows. Includes a Chandelier Exit (ATR Trailing Stop) to lock in profits dynamically. You can choose between fixed Reward-to-Risk targets (e.g., 1.5x) or disable targets to ride the trend until the trailing stop is hit.
Script protégé
Ce script est publié en source fermée. Cependant, vous pouvez l'utiliser librement et sans aucune restriction – pour en savoir plus, cliquez ici.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script protégé
Ce script est publié en source fermée. Cependant, vous pouvez l'utiliser librement et sans aucune restriction – pour en savoir plus, cliquez ici.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.