支持中心 帮助文档 联系我们
📱 微信: 18391752892 | 💬 QQ: 3313198376 | ✈️ Telegram | 📧 fishfx123@gmail.com
EURUSD 1.0856 +0.12% GBPUSD 1.2678 +0.08% USDJPY 149.23 -0.15% XAUUSD 2034.56 +0.34% EURUSD 1.0856 +0.12% GBPUSD 1.2678 +0.08% USDJPY 149.23 -0.15% XAUUSD 2034.56 +0.34%

Pair Trading Strategy

👤 作者: Ledi Haryadi

4.5 分

¥3,150.00

📌 版本: v25
📥 下载: 0
⭐ 评分: 4.5

📝 产品详情

Pair Trading Strategy

作者Ledi Haryadi
版本v25
更新8 五月 2025
激活数5
原价$450 USD

Pair Trading Strategy Based on Spearman Correlation and Stationary Z-Score  is A single-pair indicator focusing on one primary symbol (chart symbol) and one secondary symbol for the MetaTrader 4 (MT4) platform, designed to support pairs trading by analyzing the correlation between two currency pairs. It employs Spearman’s rank correlation coefficient, Z-Score calculations, and stationarity testing to generate trading signals, displayed in a subwindow and on the main chart. The indicator integrates technical filters and risk management features, with a focus on user customization.

Key Features

  1. Correlation Analysis:
    • Calculates Spearman’s rank correlation coefficient to assess the relationship between a primary symbol (chart symbol) and a secondary symbol (default: EURUSD).
    • Identifies negative (default threshold: -0.95) and positive (default threshold: 0.95) correlations to generate trading signals.
    • Displays correlation values in a subwindow as a line plot with levels at ±0.9 and 0.
  2. Z-Score and Stationarity:
    • Computes Z-Score to measure the spread deviation between pairs, using a configurable lookback period (default: 100 bars) and threshold (default: 2.5).
    • Supports stationarity testing via the Augmented Dickey-Fuller (ADF) test, with options for no transformation, first differencing, or logarithmic transformation.
    • Allows users to require stationary spreads for signal generation (default: enabled), with configurable ADF test intervals (default: 60 seconds).
  3. Technical Filters:
    • Uses Moving Average (MA, default period: 20), Relative Strength Index (RSI, default period: 14), and Bollinger Bands (default period: 20, deviations: 2.0) to filter signals.
    • Offers a Bollinger-only filter mode or no filter option, with optional Bollinger arrow display in the subwindow.
    • Configurable RSI levels for buy (default: 30) and sell (default: 70) signals.
  4. Signal Generation and Visualization:
    • Generates buy/sell signals based on correlation, Z-Score, MA, RSI, and Bollinger conditions, displayed as arrows in the subwindow, main chart, or both (configurable).
    • Supports positive and negative correlation signals, with distinct logic for each (e.g., buy Symbol1/sell Symbol2 for negative correlation).
    • Arrows on the main chart have adjustable sizes (1–5, default: 1).
  5. Overlay Chart:
    • Optionally displays the secondary symbol’s price movement on the main chart, with mirroring for negative correlations (default: enabled).
    • Normalizes price ranges over a configurable bar count (default: 100 bars) for visual comparison.
  6. Risk Management:
    • Includes Stop Loss (based on ATR, default period: 14, multiplier: 1.5), Trailing Stop (default start: 75% of target profit), and Take Profit (default reward:risk ratio: 2.0).
    • Monitors breakeven (default: 33%) and close (default: 67%) correlation levels, calculated using cointegration parameters.
    • Displays risk management data (stop loss, take profit, trailing stop, breakeven, close levels) on the main chart.
  7. Alerts and Notifications:
    • Provides alerts for new signals (current bar, closed bar, or both) and risk management updates (stop loss, take profit, etc.).
    • Supports pop-up alerts and push notifications, with configurable settings to enable/disable.
    • Prevents repeated alerts using timestamp tracking.
  8. Additional Features:
    • Calculates Average Daily Range (ADR, default period: 14 days) as a percentage for market context, displayed on the chart.
    • Implements data retrieval with retry attempts (default: 3) and timeouts (default: 500ms for data, 1000ms for ADF) to handle connectivity issues.
    • Displays cointegration parameters (d, k, m) and stationarity status on the chart.
  9. Customization:
    • Offers extensive input parameters for adjusting lookback periods, thresholds, filter settings, arrow locations, and display options (e.g., font size, arrow size).
    • Allows enabling/disabling features like RSI, Bollinger Bands, Z-Score, ADF test, overlay chart, and risk management tools.

Usage

  • Initialization: Sets the primary symbol to the chart’s symbol and validates the secondary symbol’s availability. Initializes buffers, arrays, and ADF test if enabled.
  • Operation: Calculates correlations, Z-Scores, and technical indicators per bar, updating signals, arrows, and chart overlays. Refreshes on-chart information every 60 seconds.
  • Visualization: Plots Spearman correlation in a subwindow, places signal arrows on the main chart or subwindow, and displays risk and correlation data on the chart.
  • Deinitialization: Removes all indicator objects (arrows, labels, overlay lines) upon removal.

Notes

  • Requires sufficient historical data for calculations (minimum bars based on lookback and filter periods).
  • Ensures robust data handling with retry mechanisms and timeout controls.
  • The overlay chart feature is optional and can be disabled for performance.
  • When using Pair Trading Strategy Based on Spearman , make sure to limit the bars in the Max bars in chart option to below 2000, for example 500.

 


安全须知

本产品仅通过 MQL5.com 官方渠道获取。其他渠道版本可能缺少完整功能和技术支持。

EA 配置

交易品种XAUUSD
时间框架H1 (推荐)
推荐经纪商IC Markets, IC Trading
最低存款$300 / 0.01手

📸 截图预览