Johnny's Machine Learning Moving Average (MLMA) w/ Trend Alerts

Johnny's Machine Learning Moving Average (MLMA) w/ Trend Alerts is a powerful adaptive moving average indicator designed to capture market trends dynamically. Unlike traditional moving averages (e.g., SMA, EMA, WMA), this indicator incorporates volatility-based trend detection, Bollinger Bands, ADX, and RSI, offering a comprehensive view of market conditions.
The MLMA is "machine learning-inspired" because it adapts dynamically to market conditions using ATR-based windowing and integrates multiple trend strength indicators (ADX, RSI, and volatility bands) to provide an intelligent moving average calculation that learns from recent price action rather than being static.
🛠 How It Works
1️⃣ Adaptive Moving Average Selection
The MLMA automatically selects one of four different moving averages:
📊 EMA (Exponential Moving Average) – Reacts quickly to price changes.
🔵 HMA (Hull Moving Average) – Smooth and fast, reducing lag.
🟡 WMA (Weighted Moving Average) – Gives recent prices more importance.
🔴 VWAP (Volume Weighted Average Price) – Accounts for volume impact.
The user can select which moving average type to use, making the indicator customizable based on their strategy.
2️⃣ Dynamic Trend Detection
ATR-Based Adaptive Window 📏
- The Average True Range (ATR) determines the window size dynamically.
- When volatility is high, the moving average window expands, making the MLMA more stable.
- When volatility is low, the window shrinks, making the MLMA more responsive.
Trend Strength Filters 📊
- ADX (Average Directional Index) > 25 → Indicates a strong trend.
- RSI (Relative Strength Index) > 70 or < 30 → Identifies overbought/oversold conditions.
- Price Position Relative to Upper/Lower Bands → Determines bullish vs. bearish momentum.
3️⃣ Volatility Bands & Dynamic Support/Resistance
Bollinger Bands (BB) 📉
- Uses standard deviation-based bands around the MLMA to detect overbought and oversold zones.
- Upper Band = Resistance, Lower Band = Support.
- Helps traders identify breakout potential.
Adaptive Trend Bands 🔵🔴
- The MLMA has built-in trend envelopes.
- When price breaks the upper band, bullish momentum is confirmed.
- When price breaks the lower band, bearish momentum is confirmed.
4️⃣ Visual Enhancements
Dynamic Gradient Fills 🌈
- The trend strength (ADX-based) determines the gradient intensity.
- Stronger trends = More vivid colors.
- Weaker trends = Lighter colors.
Trend Reversal Arrows 🔄
- 🔼 Green Up Arrow: Bullish reversal signal.
- 🔽 Red Down Arrow: Bearish reversal signal.
Trend Table Overlay 🖥
- Displays ADX, RSI, and Trend State dynamically on the chart.
📢 Trading Signals & How to Use It
1️⃣ Bullish Signals 📈
✅ Conditions for a Long (Buy) Trade:
- The MLMA crosses above the lower band.
- The ADX is above 25 (confirming trend strength).
- RSI is above 55, indicating positive momentum.
- Green trend reversal arrow appears (confirmation of a bullish reversal).
🔹 How to Trade It:
- Enter a long trade when the MLMA turns bullish.
- Set stop-loss below the lower Bollinger Band.
- Target previous resistance levels or use the upper band as take-profit.
2️⃣ Bearish Signals 📉
✅ Conditions for a Short (Sell) Trade:
- The MLMA crosses below the upper band.
- The ADX is above 25 (confirming trend strength).
- RSI is below 45, indicating bearish pressure.
- Red trend reversal arrow appears (confirmation of a bearish reversal).
🔹 How to Trade It:
- Enter a short trade when the MLMA turns bearish.
- Set stop-loss above the upper Bollinger Band.
- Target the lower band as take-profit.
💡 What Makes This a Machine Learning Moving Average?
📍 1️⃣ Adaptive & Self-Tuning
Unlike static moving averages that rely on fixed parameters, this MLMA automatically adjusts its sensitivity to market conditions using:
- ATR-based dynamic windowing 📏 (Expands/contracts based on volatility).
- Adaptive smoothing using EMA, HMA, WMA, or VWAP 📊.
- Multi-indicator confirmation (ADX, RSI, Volatility Bands) 🏆.
📍 2️⃣ Intelligent Trend Confirmation
- The MLMA "learns" from recent price movements instead of blindly following a fixed-length average.
- It incorporates ADX & RSI trend filtering to reduce noise & false signals.
📍 3️⃣ Dynamic Color-Coding for Trend Strength
- Strong trends trigger more vivid colors, mimicking confidence levels in machine learning models.
- Weaker trends appear faded, suggesting uncertainty.
🎯 Why Use the MLMA?
✅ Pros
✔ Combines multiple trend indicators (MA, ADX, RSI, BB).
✔ Automatically adjusts to market conditions.
✔ Filters out weak trends, making it more reliable.
✔ Visually intuitive (gradient colors & reversal arrows).
✔ Works across all timeframes and assets.
⚠️ Cons
❌ Not a standalone strategy → Best used with volume confirmation or candlestick analysis.
❌ Can lag slightly in fast-moving markets (due to smoothing).
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.
Declinazione di responsabilità
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.