3,5 KiB
3,5 KiB
US_rates_4_forex
US Rates WFO: Beta-Driven Forex Strategy
Overview
US_Rates_WFO is a quantitative Expert Advisor (EA) for MetaTrader 5. It trades major currency pairs (EURUSD, USDJPY, etc.) by analyzing their statistical relationship with the US Bond Market (using TLT as a proxy for US Treasury yields).
Unlike static strategies, this EA utilizes Walk-Forward Optimization (WFO). Before every trade, it runs an internal simulation on recent price history to determine the optimal statistical lookback period for the current market regime.
Key Features
- Intermarket Analysis: Trades Forex based on the flows of the US Treasury Bond market.
- Self-Optimizing (WFO): Automatically adjusts its
Beta_Perioddaily to fit the most recent market behavior. - Statistical Filtering: Filters trades based on Correlation coefficients and Economic Theory (optional).
- Volatility-Based Risk: Stops and Targets are dynamic, based on the Average True Range (ATR).
- Darwinex Ready: Uses
ORDER_FILLING_IOCfor compatibility with institutional liquidity pools.
Strategy Logic
1. The Core Hypothesis
The strategy assumes that currency pairs react to changes in US Interest Rates.
- TLT (20+ Year Treasury Bond ETF) is used as the proxy.
- Theory: When TLT falls, Yields rise -> USD often strengthens. When TLT rises, Yields fall -> USD often weakens.
2. The Mechanics
- Data Gathering: Every day at
Open_Hour(default 02:00 Server Time), the EA fetches price history for the FX pair and TLT. - Walk-Forward Optimization:
- The EA looks back
Opt_Lookback_Days(default 40 days). - It simulates the strategy using Beta periods ranging from 10 to 40 days.
- It selects the specific Beta period that would have been most profitable over this recent window.
- The EA looks back
- Signal Generation:
- It calculates the Beta (sensitivity) and Correlation using the optimized period.
- It measures the previous day's return of TLT.
- Forecast = Beta <20> TLT_Return.
- Execution: If the forecast direction is strong and correlation is high, a trade is opened.
Input Parameters
Asset Proxies
Bond_Symbol: The ticker for the bond ETF. Must be in Market Watch. Default:TLT.
Self-Optimization (WFO)
Do_Self_Optimize: Iftrue, the EA ignores the fixedBeta_Periodand finds the best one dynamically.Opt_Lookback_Days: The "Training Window" size. How far back to test parameters (e.g., 40 days).Opt_Beta_Start/End: The range of parameters to test (e.g., test lookbacks between 10 and 40 days).
Risk Management
Risk_Percent: Percentage of Account Equity to risk per trade.SL_ATR_Mult/TP_ATR_Mult: Size of Stop Loss and Take Profit relative to daily volatility.
Requirements
- MetaTrader 5 Platform.
- Data: You must have the TLT symbol (iShares 20+ Year Treasury Bond ETF) available in your broker's Market Watch.
- Liquidity: Designed for major pairs (EURUSD, USDJPY, GBPUSD, AUDUSD, USDCAD, USDCHF).
Installation
- Download the
.mq5file to yourMQL5/Expertsfolder. - Compile in MetaEditor.
- Ensure
TLTis added to your Market Watch in the terminal. - Attach the EA to a chart (Timeframe does not matter, logic is D1-based).
Disclaimer
This software is for educational purposes only. Past performance (even with WFO) does not guarantee future results. Trading Forex involves substantial risk.