Комментарии могут оставлять пользователи, купившие или арендовавшие продукт
Marco Engstermann  

Multi-Symbol Trend Indicator for MT5

Overview

The Multi-Symbol Trend Indicator is a custom technical analysis tool designed for MetaTrader 5 (MT5) platforms. It provides a comprehensive trend monitoring system across multiple trading symbols, combining popular indicators like MACD, ADX, and RSI to detect and classify market trends as bullish, bearish, or sideways. This indicator is particularly useful for traders who manage portfolios with several assets, offering real-time insights, visual overlays, a customizable dashboard, and configurable alerts/notifications.Key features include:

  • Multi-Symbol Support: Monitors a user-defined list of symbols simultaneously, with optimized performance to minimize computational load.
  • Trend Detection Logic: Uses a hybrid approach for robust trend identification, requiring confirmation bars to reduce false signals.
  • Visual Aids: Overlays trend-colored price lines, daily high/low levels, Fibonacci retracements, and Points of Interest (POIs) on the chart.
  • Dashboard: An on-chart panel displaying trend outlooks and current prices for selected symbols.
  • Alerts and Notifications: Pop-up alerts, mobile push, email, and repeating reminders for trend changes or ongoing trends.
  • POI Calculation: Identifies key swing levels using fractal-based detection, auto-adjusted for timeframe granularity.

The indicator is attached to a single chart (e.g., on XAUUSD) but can track trends for other symbols in the background. It plots visuals only on the attached chart's symbol for clarity.

Input Parameters

The indicator offers extensive customization through input parameters, grouped for ease of use:

  • Symbols Settings:
    • SymbolsList (string, default: "XAUUSD,EURUSD"): Comma-separated list of symbols to monitor (e.g., forex pairs, commodities, indices).
    • SymbolSuffix (string, default: ""): Optional suffix for broker-specific symbol names (e.g., "c" for XAUUSDc).
  • Indicator Periods:
    • MACD_Fast_Period (int, default: 12): Fast EMA period for MACD.
    • MACD_Slow_Period (int, default: 26): Slow EMA period for MACD.
    • MACD_Signal_Period (int, default: 9): Signal line SMA period for MACD.
    • ADX_Period (int, default: 14): Period for ADX trend strength indicator.
    • RSI_Period (int, default: 14): Period for RSI momentum oscillator.
  • Thresholds and Confirmations:
    • ADX_Threshold (double, default: 25.0): Minimum ADX value to confirm a strong trend.
    • ConfirmationBars (int, default: 3): Number of consecutive bars required to validate a trend change (1 for immediate alerts).
  • POI Settings:
    • AutoFractal (bool, default: true): Automatically adjusts fractal length based on timeframe (e.g., 1 for M1-M15, 5 for D1).
    • FractalLength (int, default: 1): Manual fractal bars if AutoFractal is false (1-2 for lower TFs, 3-7 for higher).
    • SwingLookback (int, default: 100): Maximum bars to scan for swing highs/lows; auto-scaled for higher TFs (capped at 500).
    • POI_Color (color, default: clrDeepSkyBlue): Color for POI horizontal line.
    • POI_Style (int, default: STYLE_DASH): Line style (0: Solid, 1: Dash, etc.).
  • Alerts and Notifications:
    • ShowAlerts (bool, default: false): Enables MT5 pop-up alerts for trend changes.
    • SendMobileNotifications (bool, default: false): Sends push notifications to mobile (requires MetaQuotes ID setup in MT5).
    • SendEmailNotifications (bool, default: false): Sends emails (requires email configuration in MT5).
    • TrendRepeatAfter (enum, default: Disabled): Interval for repeating trend reminders (options: Every_5_minutes, Every_10_minutes, etc.).
  • Dashboard Settings:
    • EnableDashboard (bool, default: true): Toggles the on-chart dashboard.
    • MaxDashboardSymbols (int, default: 0): Limits symbols shown (0 = all).
    • DashboardX (int, default: 30): Horizontal pixel offset from top-left corner.
    • DashboardY (int, default: 100): Vertical pixel offset.
    • DashboardFontSize (int, default: 10): Font size for dashboard text.

These parameters allow traders to tailor the indicator to their strategy, timeframe, and risk tolerance.

How the Indicator Works

  1. Initialization:
    • Parses the symbols list and validates each symbol's existence.
    • Creates separate handles for MACD, ADX, and RSI indicators per symbol.
    • Auto-adjusts POI fractal length and lookback based on the chart's timeframe (e.g., shorter for intraday, longer for daily/weekly).
    • Sets up dashboard labels if enabled.
    • Initializes a 60-second timer for alert checks and reminders.
  2. Calculation:
    • Triggered on each tick or new bar.
    • For the attached chart's symbol: Full buffer updates and visual plotting.
    • For other symbols: Minimal data copying (1-4 bars) unless a new bar forms, to optimize performance.
    • Computes trend state per bar:
      • Strong trend if ADX > threshold.
      • Bullish: MACD main > signal AND RSI > 50.
      • Bearish: MACD main < signal AND RSI < 50.
      • Sideways: Otherwise.
    • Checks for trend changes after confirmation bars.
    • Updates daily high/low and calculates POI on new bars or trend shifts:
      • POI: Recent swing low (bullish) or high (bearish) using non-strict fractal detection (allows ties for flexibility).
    • Draws/updates visuals only for the current symbol.
  3. Deinitialization:
    • Releases indicator handles.
    • Deletes dashboard labels and graphical objects (lines, labels).
    • Kills the timer.
  4. Timer:
    • Runs every 60 seconds.
    • Handles repeating trend reminders if enabled and trend persists.
Visual Elements
  • Trend Line Plot: A colored line overlaying the price chart (green for bullish, red for bearish, yellow for sideways). Width: 5 pixels.
  • Daily High/Low Lines: Solid blue (high) and red (low) horizontal lines with labels ("DH", "DL").
  • Fibonacci Retracements: Dashed gray lines at standard levels (0%, 23.6%, 38.2%, 50%, 61.8%, 100%) between daily low and high, with value labels.
  • POI Line: Custom-colored (default: deep sky blue) dashed horizontal line at the calculated swing level, with a "POI" label.
  • Dashboard: Text labels in the top-left corner (customizable position/size), showing per-symbol trend outlook (e.g., "XAUUSD Trend Outlook: Bullish (Strong Uptrend Detected)") and current price. Colored to match trend state.

All visuals update dynamically on level changes or new bars, with labels positioned to the right of the current bar for visibility.

Alerts and Notifications

  • Trigger Conditions: On confirmed trend changes (after ConfirmationBars).
  • Message Format: Includes symbol, trend description (e.g., "Bullish (Strong Uptrend Detected)"), and current price (formatted to symbol's digits).
  • Types:
    • Pop-up: Via MT5's built-in alert system.
    • Mobile: Via push notifications (setup required).
    • Email: Via MT5's email sending feature (setup required).
  • Repeating Reminders: For ongoing non-sideways trends, at selected intervals (e.g., every 15 minutes).
  • New bar detection ensures alerts align with bar closes, reducing noise.
Performance and Optimization
  • Multi-Symbol Efficiency: Uses separate handles and selective data copying to handle dozens of symbols without lagging.
  • Error Handling: Skips invalid symbols, logs failures (e.g., for missing data).
  • Timeframe Adaptability: POI auto-adjustment ensures relevance across TFs (e.g., finer granularity on M5 vs. D1).
  • Resource Management: Caps lookback scans, uses timers for non-critical tasks.

This indicator empowers traders to stay informed on multi-asset trends without constant manual switching, making it ideal for portfolio management or automated reminders.