Building a Two-Symbol Forex Hedge Expert Advisor in MT4
Summary
The article outlines a MetaTrader 4 Expert Advisor that trades a pair of forex symbols as a hedge. It explains using MarketInfo to access prices and trading properties for symbols beyond the active chart, and it recommends choosing pairs whose prices tend to move together or in opposite directions. The example uses EURJPY and GBPJPY, with configurable order sizes, profit and loss thresholds, correlation settings, and a switch to block new orders while still allowing closures.
The EA calculates correlation from deviations of daily closes from a moving average, then uses separate functions to send and manage hedge orders. The article presents this as a coding example rather than a validated trading strategy: it supplies no performance evidence, and its sample correlation assumptions are not substantiated. It also says the approach cannot be tested in the MetaTrader Strategy Tester and calls for live testing, which limits reproducibility and carries practical risk. Traders would need to assess the pair relationship, execution behavior, and risk controls independently.
Key ideas
- A hedge EA can access and trade symbols other than the one displayed on the active chart.
- The example selects two forex pairs based on an expected same-direction or opposite-direction relationship.
- Its correlation function compares deviations from a moving average over a configurable period.
- Separate order functions are used to send and close trades while tracking symbol-specific settings.
- The article provides no backtest evidence and says its example cannot be evaluated in the Strategy Tester.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.