Atualizado
[blackcat] L3 Magic-9 Sequential MACD

OVERVIEW
The [blackcat] L3 Magic-9 Sequential MACD indicator is an advanced tool designed to enhance the traditional Moving Average Convergence Divergence (MACD) by incorporating sequential patterns. This script calculates various MACD components and applies custom logic to identify potential buy and sell signals based on specific sequential conditions 📊💹.
FEATURES
Calculates MACD Line, Signal Line, and enhanced histogram.
Plots colored histograms to visualize differences between MACD line and signal line:
Positive histogram bars indicate bullish momentum.
Negative histogram bars indicate bearish momentum.
Identifies sequential patterns in the MACD line for generating buy ('Buy') and sell ('Sell') signals 🏷️.
Adds numerical labels (e.g., '5', '6', '7', etc.) to mark specific sequential conditions.
Supports customizable colors and styles for plotted elements ⚙️.
Generates alerts for identified sequential patterns 🔔.
HOW TO USE
Add the indicator to your TradingView chart by selecting it from the indicators list.
Adjust the input parameters for Fast Length, Slow Length, and Signal Length.
Monitor the chart for labeled buy/sell signals and numerical markers indicating sequential patterns.
Set up alerts based on the generated signals to receive notifications when conditions are met 📲.
Use the indicator alongside other technical analysis tools for better decision-making.
LIMITATIONS
The effectiveness of sequential patterns may vary depending on market conditions.
False signals can occur in highly volatile or ranging markets 🌪️.
Users should always confirm signals with other forms of analysis before entering trades.
NOTES
Ensure that you have sufficient historical data available for accurate MACD calculations.
Test the indicator thoroughly on demo accounts before applying it to live trading 🔍.
Customize the appearance of the plotted elements as needed to suit your chart layout.
The [blackcat] L3 Magic-9 Sequential MACD indicator is an advanced tool designed to enhance the traditional Moving Average Convergence Divergence (MACD) by incorporating sequential patterns. This script calculates various MACD components and applies custom logic to identify potential buy and sell signals based on specific sequential conditions 📊💹.
FEATURES
Calculates MACD Line, Signal Line, and enhanced histogram.
Plots colored histograms to visualize differences between MACD line and signal line:
Positive histogram bars indicate bullish momentum.
Negative histogram bars indicate bearish momentum.
Identifies sequential patterns in the MACD line for generating buy ('Buy') and sell ('Sell') signals 🏷️.
Adds numerical labels (e.g., '5', '6', '7', etc.) to mark specific sequential conditions.
Supports customizable colors and styles for plotted elements ⚙️.
Generates alerts for identified sequential patterns 🔔.
HOW TO USE
Add the indicator to your TradingView chart by selecting it from the indicators list.
Adjust the input parameters for Fast Length, Slow Length, and Signal Length.
Monitor the chart for labeled buy/sell signals and numerical markers indicating sequential patterns.
Set up alerts based on the generated signals to receive notifications when conditions are met 📲.
Use the indicator alongside other technical analysis tools for better decision-making.
LIMITATIONS
The effectiveness of sequential patterns may vary depending on market conditions.
False signals can occur in highly volatile or ranging markets 🌪️.
Users should always confirm signals with other forms of analysis before entering trades.
NOTES
Ensure that you have sufficient historical data available for accurate MACD calculations.
Test the indicator thoroughly on demo accounts before applying it to live trading 🔍.
Customize the appearance of the plotted elements as needed to suit your chart layout.
Notas de Lançamento
OVERVIEWThis indicator merges the Magic-9 Sequential pattern recognition system with MACD analysis to create a comprehensive trading tool. It combines cycle detection from John F. Ehlers' methods with MACD's momentum measurement to identify both trend direction and strength. The script generates visual alerts for sequential price patterns while overlaying MACD data for confirmation.
CORE FUNCTIONALITY
The algorithm operates on two primary axes:
MACD Analysis
Calculates standard MACD lines using customizable periods (default: 12/26/9)
Enhances histogram visualization with directional coloring
Adds confidence layer through line thickness variation
Pattern Recognition
Detects sequential occurrences of MACD line behavior
Visualizes numeric identifiers for recognized sequences
Generates BUY/SELL labels at critical transition points
UNIQUE FEATURES
✅ Dual Confirmation System:
MACD histograms provide immediate momentum insights
Sequential numbers highlight established trends
Labels confirm valid trade setups
✅ Dynamic Coloring Scheme:
Green/Red labels match MACD histogram colors
Lime/Yellow coloring indicates positive/negative changes
Confident signals use thicker line styles
TECHNICAL DETAILS
The script employs three key modules:
// MACD Calculation
[macd_line, signal_line, histogram] = ta.macd(close, fast_length, slow_length, signal_length)
// Pattern Validation
high_9 = count_true_values(macd_line > get_first_non_na_value(macd_line, 4), 9) == 9 and count_true_values(macd_line > get_first_non_na_value(macd_line, 4), 10) == 9
// Label Generation
label_9 = high_9 ?
label.new(...) :
low_9 ?
label.new(...) :
na
LIMITATIONS
❗️ Requires minimum 14 bars for accurate sequence detection
❗️ Most effective on trending instruments due to its cyclical nature
❗️ Label placement may shift during rapid market movements
OPTIMIZATION TIPS
For optimal performance:
Parameter Tuning:
Adjust MACD periods based on asset volatility
Fine-tune threshold values for specific market conditions
Label Management:
Regularly delete old labels to prevent clutter
Use var label declarations for persistent markers
Notas de Lançamento
█ OVERVIEWL3 Magic-9 Sequential MACD counts consecutive momentum bars of the MACD line and trades the moment a streak ends — the exhaustion point of a push. V2 adds a governed position state machine, explicit exits, ATR risk levels, optional re-entry, a live dashboard and a full alert set on top of the classic Magic-9 sequential engine.
█ CONCEPTS
• Momentum streak counting: the MACD line is measured against its own recent reference; every bar that keeps the direction extends the sequence.
• Milestone labels: numbers 5-13 mark how long the current push has lasted; each milestone prints once, when the streak first reaches that length.
• Streak-end signals: Buy / Sell fire when a sequence of at least the trigger length finally breaks — the first sign of exhaustion.
• Governance: a position state machine enforces one signal at a time, same-bar entry/exit exclusivity and a configurable cooldown, so signals no longer repeat on every bar of an ongoing streak.
█ HOW TO USE
1 — Apply the indicator to any symbol and timeframe; the default MACD 12/26/9 fits most markets.
2 — Watch the numbered milestone labels building up along the MACD line.
3 — Enter when Buy / Sell appears at the end of a long streak; XL / XS marks the signal-line cross exit.
4 — Read Position, Last Signal, ATR, SL/TP and cooldown in the dashboard.
Input Parameters
• MACD Fast / Slow / Signal: standard lengths, default 12 / 26 / 9.
• Streak Reference Lookback: bars used to locate the streak reference, default 4.
• Sequence Milestones 1-7: the numbered levels, default 5, 6, 7, 8, 9, 12, 13.
• Legacy V1 Signals: ON restores the original per-bar signal behavior of V1.
• Same-bar Exclusivity / Cooldown Bars: signal governance, default on / 3.
• Exit on MACD / Signal Cross: explicit cross-based exit, default on.
• ATR TP/SL Reference Levels with Length and multipliers: default 14, SL 2.0x, TP 3.0x.
• Enable Re-entry with Anchor Window: optional RL/RS re-arming after an exit, default off.
• Visual toggles: milestone labels, entry/exit labels, background color, dashboard.
█ FEATURES
• Bidirectional Buy / Sell signals with state-machine governance
• Explicit cross-based exits plus ATR stop-loss / take-profit references
• Optional re-entry (RL/RS) anchored around the exit bar
• Six alertcondition types plus rich bar-close alerts with SL/TP values
• Live dashboard and position background shading
• One switch restores the original V1 signal behavior
█ SIGNALS
• Buy / RL — long entry (green, below the MACD line)
• Sell / RS — short entry (red, above the MACD line)
• XL / XS — exit of long / short (orange x)
• Numbers 5-13 — streak milestone, green text up-streak, red text down-streak
• Background tint — current position direction
█ IMPLEMENTATION NOTES
Built on ta.macd with custom streak counters, ta.crossunder / ta.crossover exits and ta.atr risk levels. Signals are evaluated at bar close; no security calls, so no cross-timeframe repainting. TP/SL are price-based and exposed in the Data Window and dashboard.
█ LIMITATIONS
• Exhaustion entries can run against strong trends; pair with your own trend filter
• The cross-based exit lags on lower timeframes
• TP/SL values are references, not orders — validate with alerts before live use
█ NOTES
• Open source under Mozilla Public License 2.0
• V2 is the polished release of the original Magic-9 Sequential MACD idea
═════════════════════════════════════════════════════════════════════════
For questions or feedback, use the comments section below.
Feel free to use and modify — attribution appreciated.
Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq My new github for more pine development soon: github.com/wxt-coder
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq My new github for more pine development soon: github.com/wxt-coder
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.