US_rates_4_forex/README.md
exceltrader de02ee541d
2025-12-31 13:15:24 +02:00

65 行
3.5 KiB
Markdown
Raw パーマリンク Blame 履歴

# 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_Period` daily 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_IOC` for 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
1. **Data Gathering:** Every day at `Open_Hour` (default 02:00 Server Time), the EA fetches price history for the FX pair and TLT.
2. **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.
3. **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**.
4. **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`: If `true`, the EA ignores the fixed `Beta_Period` and 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
1. **MetaTrader 5 Platform.**
2. **Data:** You must have the **TLT** symbol (iShares 20+ Year Treasury Bond ETF) available in your broker's Market Watch.
3. **Liquidity:** Designed for major pairs (EURUSD, USDJPY, GBPUSD, AUDUSD, USDCAD, USDCHF).
## Installation
1. Download the `.mq5` file to your `MQL5/Experts` folder.
2. Compile in MetaEditor.
3. Ensure `TLT` is added to your Market Watch in the terminal.
4. 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.*