TwinEdge Hedging Pairs Trading EA MT5
- Uzmanlar
- Omar Abo Hatab
- Sürüm: 1.0
- Etkinleştirmeler: 5
Special Launch Offer!
Get the Risk Control Panel for $30 — limited time offer.
Overview
TwinEdge Hedging Pairs Trading EA is an advanced trading system designed to profit from price imbalances between two correlated instruments.
By combining pairs trading, spread trading, and statistical arbitrage techniques, the EA automatically opens hedged positions on two symbols, aiming to capture mean reversion while reducing overall market exposure.
This system does not rely on market direction. Instead, it trades the relationship between assets.
How It Works
- Monitors two correlated symbols in real time
- Detects spread deviations between instruments
- Opens hedged buy/sell positions when an imbalance occurs
- Closes trades when prices return to equilibrium
Key Features
- Hedging strategy with simultaneous buy and sell positions
- Pairs trading logic focused on asset relationships rather than direction
- Spread trading system designed to capture price inefficiencies
- Market-neutral approach suitable for both bullish and bearish conditions
- Fully automated trade management, including entries, exits, and risk control
- No martingale and no grid techniques used
Advantages
- Reduces exposure to overall market trends
- Trades only under high-probability conditions
- Diversifies risk across two instruments
- Designed for stable and consistent performance
Important Notes
This is a low-frequency strategy. Trades occur only when valid setups are detected. For that reason, trading multiple symbols helps build a more diversified portfolio.
1. How to Use the EA
Step 1 – Attach to Chart
- Attach the EA to any chart
- The chart symbol does not matter
- The EA uses Symbol1 and Symbol2 inputs only
Step 2 – Enable AutoTrading
- Make sure AutoTrading is enabled in MT5
- Allow algo trading in EA settings
2. Input Settings Explained
SYMBOLS & TIMEFRAME
Symbol1 (S1)
Primary instrument
Symbol2 (S2)
Secondary instrument
Timeframe
Defines the timeframe the EA uses to perform its calculations (spread, correlation, Z-score, etc.)
It is independent from the chart timeframe where the EA is attached
TRADING MODE
Trade Mode
Controls which symbols are traded:
- Both Symbols → Opens full hedge (default)
- Only Symbol 1 → Trades only S1 side
- Only Symbol 2 → Trades only S2 side
Trade Direction
Controls allowed trade direction:
- Both Directions → Normal operation (default)
- Long Only → Only buy-based setups
- Short Only → Only sell-based setups
Even when Only Symbol 1, Only Symbol 2, Long Only, or Short Only modes are selected, the EA still uses both symbols to perform all internal calculations (spread, correlation, Z-score, etc.).
DIVERGENCE SETTINGS
These define when trades open and close.
Lookback Period
- Number of bars used to calculate spread statistics
- Higher = more stable, slower signals
Entry Threshold
- Z-score level required to open a trade
- Example: 2.0 → trade opens when spread is far from mean
Higher value:
- Trades are triggered at larger deviations from the mean
- Typically results in fewer trade signals
Lower value:
- Trades are triggered at smaller deviations
- Typically results in more frequent signals
Close Level
- Z-score level where trades close
- Usually set to 0 (mean reversion)
HEDGE RATIO
Use Hedge Ratio
- If enabled, EA calculates dynamic hedge ratio
- This balances position sizes between S1 and S2
If enabled, the EA automatically adjusts the position size of Symbol 2 relative to Symbol 1 based on their price relationship. This keeps the hedge balanced by aligning the exposure between the two instruments.
Hedge Ratio Period
- Number of bars used to calculate hedge ratio
LOT SIZE
- The Lot size is for Symbol 1 only
Important:
- The EA automatically calculates the lot size for Symbol 2
- This is based on the hedge ratio
You do NOT need to set S2 lot size manually.
STOP LOSS
SL From Mean
- Stop loss based on Z-score distance from mean
- Example: 3.5 → trade closes if spread moves too far
- Set to 0 to disable
SL Emergency S1
- Emergency stop loss for Symbol 1 (percentage)
SL Emergency S2
- Emergency stop loss for Symbol 2
These act as fail-safe protection in case of extreme moves. If either symbol reaches its emergency stop loss, both positions are closed simultaneously
FILTERS
Filters improve trade quality by avoiding weak relationships.
Use Correlation Filter
- Enables correlation check between symbols
Correlation Period
- Number of bars used to calculate correlation
Min Correlation
- Minimum required correlation (e.g., 0.7)
- If correlation is too low → no trade
- Use ranges from 0 to 1 (1 is the max correlation) the higher value, the less trades.
Correlation: measures short-term movement similarity between two symbols (how closely they move together).
Use Cointegration Filter
- Enables statistical cointegration test
Cointegration Period
- Data length for cointegration calculation
ADF Critical Value
- Threshold for stationarity test
This ensures:
- The pair has a stable long-term relationship
- Recommended: keep enabled
Cointegration: measures long-term statistical relationship where the price spread tends to revert to a stable mean.
EXECUTION
Magic Number
- Unique ID for EA trades
- Use different values if running multiple EAs
Slippage
- Maximum allowed slippage in points
Exit After Bars
- Closes trades after a fixed number of bars
- 0 = disabled
- Useful to limit trade duration

