Pro MACD Signal Line Zero Level Multi Filter Cross
- Indicatori
- Versione: 1.0
- Attivazioni: 5
Pro MACD Signal Line Zero Level Multi Filter Cross
Overview
MACD Zero Cross Histogram Multi Filter is a technical analysis indicator for MetaTrader 4 designed to identify momentum shifts, signal-line crossovers, and zero-level transitions using a four-color dynamic MACD histogram paired with a modular 15-filter validation framework. Built for discretionary and rule-based traders across Forex, commodities, indices, and CFDs, this indicator separates raw momentum signals from filtered setups by evaluating every candidate crossover against user-selected trend, volatility, oscillator, and market-structure conditions. When a valid setup occurs on a closed candle, the indicator plots directional signal arrows on the main chart, projects dynamic ATR-based Entry, Stop Loss, and three Risk-to-Reward Take Profit levels (1R, 2R, and 3R) for the most recent active signal, and dispatches alerts across terminal pop-ups, audio files, mobile push notifications, and email.
Operating Principle and Signal Logic
The indicator operates through a sequential four-stage analytical pipeline executed on completed price bars:
- Core MACD Momentum Calculation: Computes the standard MACD main line (difference between Fast EMA and Slow EMA), the Signal line (SMA of the MACD main line), and the MACD histogram (difference between the MACD main line and Signal line) using the user-defined price source.
- Three Selectable Trigger Modes: Users can choose between three distinct crossover mechanisms via the EntryMethod parameter:
* Mode 0 (ENTRY_MACD_CROSS_SIGNAL): Generates a Buy trigger when the MACD main line crosses above the Signal line on a closed bar, and a Sell trigger when the MACD main line crosses below the Signal line.
* Mode 1 (ENTRY_MACD_CROSS_ZERO): Generates a Buy trigger when the MACD main line crosses from negative territory above the zero baseline, and a Sell trigger when the MACD main line crosses from positive territory below the zero baseline.
* Mode 2 (ENTRY_MACD_CROSS_SIGNAL_ZERO): Combines both conditions by requiring a bullish MACD-above-Signal crossover to occur strictly while the MACD main line is at or above the zero level for Buy setups, and a bearish MACD-below-Signal crossover to occur strictly while the MACD main line is at or below the zero level for Sell setups.
- Modular 15-Filter Validation Gate: Every raw MACD trigger is passed through an optional multi-filter suite where only enabled filters are evaluated. A signal is confirmed only when all active filters agree with the trade direction:
* Filter 1 (RSI Cross Filter): Confirms momentum recovery from oversold territory for Buy triggers and exhaustion from overbought territory for Sell triggers.
* Filter 2 (ADX Filter): Verifies that underlying trend strength meets or exceeds the minimum ADX threshold before allowing a signal.
* Filter 3 (Single MA Filter): Enforces directional price alignment above a baseline Moving Average for Buy signals and below it for Sell signals.
* Filter 4 (Ichimoku Senkou Span B Filter): Uses the long-term Ichimoku cloud boundary as a macro trend bias filter, requiring closing price alignment above or below Senkou Span B.
* Filter 5 (RSI 75 Filter): Applies a long-period RSI regime filter around the neutral midpoint to separate bullish and bearish macro momentum phases.
* Filter 6 (Double MA Filter): Evaluates the directional relationship between a faster Moving Average and a slower Moving Average to confirm broader trend structure.
* Filter 7 (Awesome Oscillator Filter): Supports configurable momentum magnitude thresholds, bar-to-bar color slope direction, and zero-line polarity alignment.
* Filter 8 (Parabolic SAR Filter): Requires price to trade above the Parabolic SAR dots for Buy setups and below the dots for Sell setups.
* Filter 9 (Heiken Ashi Filter): Smooths price noise through synthetic Heiken Ashi candles, permitting Buy signals only on bullish smoothed bodies and Sell signals only on bearish smoothed bodies.
* Filter 10 (CCI Trend Filter): Uses a medium-term Commodity Channel Index relative to its zero baseline to confirm directional bias.
* Filter 11 (CCI OB and OS Filter): Validates directional momentum breakouts beyond configured upper and lower CCI threshold levels.
* Filter 12 (RVI Filters): Incorporates both a long-period Relative Vigor Index baseline check and a shorter-period RVI main-versus-signal line alignment check.
* Filter 13 (MACD Filters): Provides an independent secondary MACD histogram polarity and zero-level confirmation layer with separate period settings.
* Filter 14 (SR and Fibonacci Filters): Evaluates price proximity to dynamic swing Support/Resistance zones and swing-derived Fibonacci retracement bands before confirming entries.
* Filter 15 (Supertrend Filter): Computes an ATR-based trend band direction and filters out signals that oppose the active Supertrend regime.
- Signal Validity and Non-Repainting Behavior: All crossover triggers and confirmation filters are evaluated exclusively on closed historical bars (bar index 1 and higher). Signals are never generated on the unclosed forming bar (bar index 0). Once a candle closes and a Buy or Sell arrow is plotted on the chart, that signal remains permanently fixed and does not repaint, recalculate, or disappear on subsequent ticks. Real-time alerts are dispatched once per newly closed candle (bar index 1).
- ATR-Based Target Level Projection: Upon confirming the most recent valid signal, the indicator measures market volatility using the Average True Range (ATR) on that signal bar and plots five horizontal reference lines extending to the right of the current candle: Entry price, Stop Loss (Entry +/- ATR multiplied by ATR_Multiplier), TP1 at 1:1 Risk-to-Reward (1R), TP2 at 2:1 Risk-to-Reward (2R), and TP3 at 3:1 Risk-to-Reward (3R). Only the latest active signal displays target lines to keep the chart clean and readable.
Key Technical Features
- Dynamic Four-Color Histogram: Distinguishes expanding and contracting bullish and bearish momentum phases directly inside the separate indicator sub-window.
- Three Built-In Entry Modes: Switch seamlessly between Signal Line Crossover, Zero Level Crossover, and Zero-Filtered Signal Crossover without changing indicators.
- 15 Independent Confirmation Filters: Every filter can be toggled on or off individually, allowing traders to run a pure MACD setup or combine multiple trend, momentum, and structure filters.
- Automated ATR Risk-to-Reward Levels: Calculates and draws Entry, SL, TP1 (1R), TP2 (2R), and TP3 (3R) lines with customizable colors, line styles, widths, right-edge extension, and price labels.
- Customizable Chart Arrows: Plots clean Wingdings directional arrows at an adjustable point offset from candle highs and lows.
- Multi-Channel Alert System: Supports MetaTrader pop-up alerts, custom WAV sound alerts, mobile push notifications, and email alerts containing symbol, direction, Entry, SL, TP1, TP2, and TP3 values.
- Automatic Object Cleanup: Removes all indicator-generated arrows, target lines, and price labels cleanly when the indicator is detached or timeframe settings are changed.
Graphical User Interface and Visual Legend
The indicator renders visual elements across both its dedicated sub-window and the primary price chart:
- Sub-Window Histogram Buffer 0 (Default: LimeGreen): Bullish momentum above zero where current histogram value is greater than the previous bar (expanding bullish momentum).
- Sub-Window Histogram Buffer 1 (Default: DarkGreen): Bullish momentum above zero where current histogram value is less than or equal to the previous bar (contracting bullish momentum).
- Sub-Window Histogram Buffer 2 (Default: Red): Bearish momentum below zero where current histogram value is lower than the previous bar (expanding bearish momentum).
- Sub-Window Histogram Buffer 3 (Default: Maroon): Bearish momentum below zero where current histogram value is higher than or equal to the previous bar (contracting bearish momentum).
- Sub-Window Buffer 4 (Default: DodgerBlue): MACD main line.
- Sub-Window Buffer 5 (Default: Magenta): MACD Signal line.
- Main Chart Buy Arrow (Default: Aqua): Upward Wingdings arrow (code 233) placed below the signal candle low.
- Main Chart Sell Arrow (Default: Red): Downward Wingdings arrow (code 234) placed above the signal candle high.
- Main Chart Target Lines: Solid Gold line for Entry level, dashed Red line for Stop Loss (SL), dashed LimeGreen line for TP1 (1R), dashed MediumSeaGreen line for TP2 (2R), and dashed DodgerBlue line for TP3 (3R), each accompanied by a right-aligned price label.
Operation Recommendations and Terminal Performance
- Recommended Instruments: Suitable for major and minor Forex currency pairs (such as EURUSD, GBPUSD, USDJPY, AUDUSD, USDCAD, EURJPY), precious metals (XAUUSD), and liquid index CFDs. When trading instruments with wider spreads or variable tick sizes, adjust ArrowDistance and SR_Zone_Points accordingly.
- Supported Timeframes: Operates across all standard MetaTrader 4 timeframes. For intraday scalping, M5 and M15 are recommended; for day trading, M30 and H1 provide balanced signal frequency; for swing trading, H4 and D1 offer broader structural signals.
- Account and Execution Environment: Compatible with all standard MT4 account types (Hedging and Netting). An ECN or raw-spread broker environment is recommended when applying the indicator on lower timeframes (M5 to M15) so that ATR-based TP1 and SL distances remain proportional to transaction costs.
- CPU and Memory Efficiency: During initial loading, the indicator processes historical bars in a single chronological pass and subsequently updates only newly formed bars on each tick. Only enabled filters execute calculations during live operation. To maintain optimal terminal responsiveness on workstations with limited hardware resources, avoid attaching multiple instances with all 15 filters enabled simultaneously across dozens of open charts.
- Alert Configuration Notes: Ensure that terminal audio is enabled in MetaTrader 4 (Tools -> Options -> Events) for sound alerts, a valid MetaQuotes ID is configured under the Notifications tab for mobile push alerts, and valid SMTP server credentials are configured under the Email tab for email dispatches.
Input Parameters
Below is the complete list of all input parameters available in the MetaTrader 4 Inputs tab, organized by functional group:
Section 1: Entry Logic and Core Parameters
- InpSection1 (Default: "=== [LOGIC] Entry Method Selection ===") - Visual separator header for the entry mode group in the Inputs tab.
- EntryMethod (Default: ENTRY_MACD_CROSS_SIGNAL) - Selects the primary signal trigger logic: ENTRY_MACD_CROSS_SIGNAL (0 = MACD crosses Signal line), ENTRY_MACD_CROSS_ZERO (1 = MACD crosses zero level), or ENTRY_MACD_CROSS_SIGNAL_ZERO (2 = MACD crosses Signal line filtered by zero-level position).
- InpSection2 (Default: "=== [LOGIC] MACD Core Settings ===") - Visual separator header for core MACD period settings.
- FastEMA (Default: 12) - Period in bars for the fast Exponential Moving Average used in the core MACD calculation.
- SlowEMA (Default: 26) - Period in bars for the slow Exponential Moving Average used in the core MACD calculation.
- SignalSMA (Default: 9) - Period in bars for the Simple Moving Average applied to the MACD main line to form the Signal line.
- AppliedPrice (Default: PRICE_CLOSE) - Price constant (Close, Open, High, Low, Median, Typical, or Weighted) used for the core MACD calculation.
- InpSection3 (Default: "=== [LOGIC] Signal & Arrow Settings ===") - Visual separator header for chart arrow display settings.
- ArrowDistance (Default: 30) - Vertical offset distance in points between the signal candle High/Low and the plotted Buy/Sell arrow.
- ArrowSize (Default: 2) - Width/size scale (integer from 1 to 5) for Buy and Sell signal arrows on the chart.
- BuyArrowColor (Default: clrAqua) - Color applied to bullish Buy signal arrows.
- SellArrowColor (Default: clrRed) - Color applied to bearish Sell signal arrows.
- ShowArrows (Default: true) - Enables (true) or disables (false) drawing Buy and Sell arrows on the main price chart.
Section 2: ATR and Target Levels (SL/TP)
- InpSection4 (Default: "=== [TARGET] ATR & Target Levels (SL/TP) ===") - Visual separator header for ATR-based target lines.
- ShowTargetLines (Default: true) - Enables (true) or disables (false) drawing Entry, Stop Loss, and Take Profit lines for the latest confirmed signal.
- ATR_Period (Default: 7) - Lookback period in bars used to compute the Average True Range (ATR) volatility value on the signal candle.
- ATR_Multiplier (Default: 1.5) - Multiplier applied to the ATR value to define the initial risk distance (1R) between Entry and Stop Loss.
- LineExtendBars (Default: 1) - Number of chart bars to extend the horizontal target lines and labels to the right of the current bar (bar 0).
- LabelFontSize (Default: 8) - Font size in points for the price text labels displayed beside Entry, SL, TP1, TP2, and TP3 lines.
- EntryLineColor (Default: clrGold) - Color of the horizontal Entry price line and label.
- SLLineColor (Default: clrRed) - Color of the horizontal Stop Loss line and label.
- TP1LineColor (Default: clrLimeGreen) - Color of the horizontal first Take Profit line (1R) and label.
- TP2LineColor (Default: clrMediumSeaGreen) - Color of the horizontal second Take Profit line (2R) and label.
- TP3LineColor (Default: clrDodgerBlue) - Color of the horizontal third Take Profit line (3R) and label.
- TargetLineStyle (Default: STYLE_DASH) - Line style (Solid, Dash, Dot, DashDot, or DashDotDot) applied to SL, TP1, TP2, and TP3 lines.
- TargetLineWidth (Default: 1) - Line thickness in pixels for SL and TP target lines (Entry line renders at TargetLineWidth + 1).
Section 3: Alerts and Notifications
- InpSection5 (Default: "=== [LOGIC] Alerts & Notifications ===") - Visual separator header for alert settings.
- EnableAlert (Default: true) - Enables (true) or disables (false) native MetaTrader 4 pop-up alert windows when a signal closes.
- EnableSound (Default: true) - Enables (true) or disables (false) audio playback upon signal confirmation.
- AlertSoundFile (Default: "alert.wav") - Filename of the WAV audio file located inside the MetaTrader 4 Sounds directory.
- EnablePush (Default: false) - Enables (true) or disables (false) push notifications to the MetaTrader mobile app via MetaQuotes ID.
- EnableEmail (Default: false) - Enables (true) or disables (false) email notifications sent via the terminal SMTP configuration.
Section 4: 15-Filter Framework Parameters
- InpFilter1 (Default: "=== 1. RSI CROSS FILTER ===") - Header label for Filter 1 (RSI Cross).
- Use_RSI_Cross_Filter (Default: false) - Enables (true) or disables (false) the RSI threshold crossover confirmation filter.
- RSI_Length (Default: 14) - Lookback period in bars for the RSI Cross filter calculation.
- RSI_Price_Source (Default: PRICE_CLOSE) - Applied price type used to calculate RSI values.
- RSI_Oversold (Default: 30.0) - Lower RSI threshold level used to validate bullish recovery crossovers.
- RSI_Overbought (Default: 70.0) - Upper RSI threshold level used to validate bearish reversal crossovers.
- InpFilter2 (Default: "=== 2. ADX FILTER ===") - Header label for Filter 2 (ADX Trend Strength).
- Use_ADX_Filter (Default: false) - Enables (true) or disables (false) the Average Directional Index minimum trend strength filter.
- ADX_Period (Default: 10) - Lookback period in bars for the ADX main line calculation.
- ADX_Min_Level (Default: 20.0) - Minimum ADX value required to permit Buy or Sell signals.
- InpFilter3 (Default: "=== 3. SINGLE MA FILTER ===") - Header label for Filter 3 (Single Moving Average).
- Use_MA_Filter (Default: false) - Enables (true) or disables (false) price-versus-Moving-Average trend alignment filtering.
- MA_Period (Default: 50) - Averaging period in bars for the single Moving Average filter.
- MA_Method (Default: MODE_SMA) - Smoothing method (SMA, EMA, SMMA, or LWMA) for the single Moving Average filter.
- MA_Shift (Default: 0) - Horizontal shift in bars for the single Moving Average filter.
- InpFilter4 (Default: "=== 4. ICHIMOKU SENKOU SPAN B FILTER ===") - Header label for Filter 4 (Ichimoku Senkou Span B).
- Use_Ichimoku_Filter (Default: false) - Enables (true) or disables (false) closing price alignment relative to Ichimoku Senkou Span B.
- Ichimoku_Tenkan (Default: 9) - Tenkan-sen period in bars for the Ichimoku calculation.
- Ichimoku_Kijun (Default: 26) - Kijun-sen period in bars for the Ichimoku calculation.
- Ichimoku_SenkouB (Default: 52) - Senkou Span B period in bars used as the macro trend boundary.
- InpFilter5 (Default: "=== 5. RSI 75 FILTER ===") - Header label for Filter 5 (Long-Period RSI).
- Use_RSI75_Filter (Default: false) - Enables (true) or disables (false) the long-period RSI 50-level midline regime filter.
- RSI_Filter_Period (Default: 75) - Lookback period in bars for the long-period RSI regime filter.
- InpFilter6 (Default: "=== 6. DOUBLE MA FILTER ===") - Header label for Filter 6 (Double Moving Average).
- Use_DoubleMA_Filter (Default: false) - Enables (true) or disables (false) dual Moving Average directional alignment (MA A vs MA B).
- MA_A_Period (Default: 30) - Period in bars for the fast Moving Average (MA A).
- MA_A_Method (Default: MODE_EMA) - Smoothing method for MA A.
- MA_A_Applied (Default: PRICE_CLOSE) - Applied price constant for MA A.
- MA_A_Shift (Default: 0) - Horizontal bar shift for MA A.
- MA_B_Period (Default: 140) - Period in bars for the slow Moving Average (MA B).
- MA_B_Method (Default: MODE_EMA) - Smoothing method for MA B.
- MA_B_Applied (Default: PRICE_CLOSE) - Applied price constant for MA B.
- MA_B_Shift (Default: 0) - Horizontal bar shift for MA B.
- InpFilter7 (Default: "=== 7. AWESOME OSCILLATOR FILTER ===") - Header label for Filter 7 (Awesome Oscillator).
- Use_AO_Filter (Default: false) - Master toggle to enable (true) or disable (false) Awesome Oscillator sub-filters.
- Use_AO_Volume_Filter (Default: false) - Enables (true) or disables (false) minimum AO amplitude threshold checks.
- AO_Buy_Min (Default: 4.0) - Minimum positive AO threshold required when Use_AO_Volume_Filter is active for Buy signals.
- AO_Sell_Max (Default: -4.0) - Maximum negative AO threshold required when Use_AO_Volume_Filter is active for Sell signals.
- Use_AO_Color_Filter (Default: false) - Enables (true) or disables (false) bar-to-bar AO slope direction filtering (rising for Buy, falling for Sell).
- Use_AO_Zero_Filter (Default: false) - Enables (true) or disables (false) combined AO zero-line polarity and slope confirmation.
- InpFilter8 (Default: "=== 8. PARABOLIC SAR FILTER ===") - Header label for Filter 8 (Parabolic SAR).
- Use_SAR_Filter (Default: false) - Enables (true) or disables (false) Parabolic SAR directional price position filtering.
- SAR_Step (Default: 0.02) - Acceleration factor step increment for the Parabolic SAR calculation.
- SAR_Maximum (Default: 0.2) - Maximum acceleration factor cap for the Parabolic SAR calculation.
- InpFilter9 (Default: "=== 9. HEIKEN ASHI FILTER ===") - Header label for Filter 9 (Heiken Ashi).
- Use_HeikenAshi_Filter (Default: false) - Enables (true) or disables (false) smoothed Heiken Ashi candle body polarity filtering.
- InpFilter10 (Default: "=== 10. CCI TREND FILTER ===") - Header label for Filter 10 (CCI Trend).
- Use_CCI_Filter (Default: false) - Enables (true) or disables (false) zero-line Commodity Channel Index trend filtering.
- CCI_Period (Default: 50) - Lookback period in bars for the CCI Trend filter.
- CCI_Applied (Default: PRICE_CLOSE) - Applied price constant for the CCI Trend filter.
- InpFilter11 (Default: "=== 11. CCI OB & OS FILTER ===") - Header label for Filter 11 (CCI Overbought/Oversold).
- Use_CCI_OBOS_Filter (Default: false) - Enables (true) or disables (false) CCI extreme threshold momentum filtering.
- CCI_OBOS_Period (Default: 14) - Lookback period in bars for the CCI OB/OS filter.
- CCI_OBOS_Applied (Default: PRICE_CLOSE) - Applied price constant for the CCI OB/OS filter.
- CCI_Overbought (Default: 100.0) - Upper CCI threshold level for bullish momentum breakout confirmation.
- CCI_Oversold (Default: -100.0) - Lower CCI threshold level for bearish momentum breakdown confirmation.
- InpFilter12 (Default: "=== 12. RVI FILTERS ===") - Header label for Filter 12 (Relative Vigor Index).
- Use_RVI_Filter (Default: false) - Enables (true) or disables (false) long-period RVI zero-line polarity filtering.
- RVI_Period (Default: 75) - Lookback period in bars for the RVI baseline trend filter.
- Use_RVI_Signal_Filter (Default: false) - Enables (true) or disables (false) RVI main-line versus signal-line crossover alignment.
- RVI_Signal_Period (Default: 20) - Lookback period in bars for the RVI main-versus-signal filter.
- InpFilter13 (Default: "=== 13. MACD FILTERS ===") - Header label for Filter 13 (Secondary MACD Filter).
- Use_MACD_Filter (Default: false) - Enables (true) or disables (false) secondary MACD histogram polarity filtering.
- MACD_FastEMA (Default: 12) - Fast EMA period in bars for the secondary MACD filter.
- MACD_SlowEMA (Default: 26) - Slow EMA period in bars for the secondary MACD filter.
- MACD_SignalSMA (Default: 9) - Signal SMA period in bars for the secondary MACD filter.
- MACD_Applied (Default: PRICE_CLOSE) - Applied price constant for the secondary MACD filter.
- Use_MACD_Zero_Filter (Default: false) - Enables (true) or disables (false) secondary MACD main-line zero-level alignment.
- InpFilter14 (Default: "=== 14. SR & FIBONACCI FILTERS ===") - Header label for Filter 14 (Support/Resistance and Fibonacci).
- Use_SR_Filter (Default: false) - Enables (true) or disables (false) swing Support and Resistance zone proximity filtering.
- SR_Period (Default: 50) - Lookback window in bars used to identify recent swing highs and lows for Support and Resistance.
- SR_Zone_Points (Default: 80) - Tolerance zone width in points around Support and Resistance levels.
- Use_Fib_Filter (Default: false) - Enables (true) or disables (false) swing-based Fibonacci retracement zone filtering.
- Fib_Level_1 (Default: 0.382) - First Fibonacci retracement ratio boundary (default 38.2%).
- Fib_Level_2 (Default: 0.618) - Second Fibonacci retracement ratio boundary (default 61.8%).
- ZigZag_Depth (Default: 12) - Minimum bar depth parameter used to detect swing pivots for the Fibonacci filter.
- ZigZag_Deviation (Default: 5) - Minimum price deviation in points required between consecutive swing pivots.
- ZigZag_Backstep (Default: 3) - Minimum bar separation between alternating swing highs and swing lows.
- InpFilter15 (Default: "=== 15. SUPERTREND FILTER ===") - Header label for Filter 15 (Supertrend).
- Use_Supertrend_Filter (Default: false) - Enables (true) or disables (false) ATR-based Supertrend directional regime filtering.
- ST_AtrPeriod (Default: 10) - ATR lookback period in bars for the Supertrend filter calculation.
- ST_Factor (Default: 3.0) - Volatility band multiplier factor applied to the ATR in the Supertrend filter.
Risk Disclaimer
Trading foreign exchange, commodities, indices, and other leveraged financial instruments carries a high level of risk and may not be suitable for all investors. Past performance and historical signal behavior do not guarantee future results. This indicator is an analytical software tool designed solely to assist traders with technical chart analysis and risk-to-reward visualization; it does not execute trades automatically and does not constitute financial or investment advice. Always test the indicator thoroughly on a demo account to understand its behavior across different market conditions before applying it to live trading decisions.
