Mt5 Williams % Directional Index EA
This EA uses Williams' Percent Range (WPR) crossover combined with ADX directional indicator crossover (DI+/DI-) for entry signals. Exits are managed by Money Flow Index (MFI) overbought/oversold levels and Stochastic oscillator crossover patterns. It includes optional trailing stop functionality based on the previous bar's high/low.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | +0.30% | +0.26% | 0.55% | 1 | 0.00% | — | — | — | — | Too few trades |
| GBPUSD | +0.36% | +0.31% | 0.70% | 1 | 0.00% | — | — | — | — | Too few trades |
| USDJPY | +0.25% | +0.22% | 0.70% | 1 | 0.00% | — | — | — | — | Too few trades |
| XAUUSD | -0.50% | -0.41% | 14.66% | 1 | 0.00% | — | — | — | — | Too few trades |
Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.
Blow-up risk: No blow-up pattern found
None of the usual blow-up patterns were found in the code, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.
High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →
Strategy analysis
The strategy concept is a multi-indicator momentum confirmation system combining Williams' Percent Range (WPR) and ADX directional indicators (DI+/DI-) for entry signals. Entry conditions: long requires WPR crossing upward from oversold and DI+ crossing above DI- (shifting from negative to positive difference); short requires WPR crossing downward from overbought and DI+ crossing below DI- (shifting from positive to negative difference). Exit conditions operate on two layers: position management exits use MFI overbought/oversold levels (close long when MFI exceeds 79, close short when MFI falls below 21) and Stochastic crossover patterns (main line crossing above signal line closes longs, main line crossing below signal line closes shorts). Position sizing uses fixed lot sizing with single-position-only trading logic. Money management includes pip-based stop loss and take profit calculation accounting for the broker's stop level, and a trailing stop mechanism referencing the previous bar's high/low. The overall strategy is a momentum-confirmation system using multi-indicator crossover filtering to reduce false signals.
Strengths
- Multi-indicator confirmation entry with WPR and ADX dual filtering reduces false signals
- Stop loss and take profit account for broker stop level requirements, preventing order rejection
- Order sending includes retry mechanism and order checking, enhancing trade execution reliability
- New bar detection prevents duplicate trading on the same bar
- Automatic order filling type adaptation (FOK/IOC/RETURN) improves broker compatibility
Weaknesses
- Default stop loss and take profit are both 0, potentially running without any risk protection
- Trailing stop variable isTrailingStop initializes to false with no input parameter to enable it, making the feature effectively unusable
- Single-position-only mode, unable to scale in or build positions in batches
- MFI exit levels use hardcoded symmetric calculation (100-Level), not accounting for different market characteristics
- GetPipValue function does not support 6-digit decimals or special instrument types
- No spread filter, may enter trades even during high-spread conditions
Possible improvements
- Add a configurable trailing stop toggle input parameter to make the trailing stop feature accessible
- Add a spread filter to prevent opening positions when spread is excessively wide, avoiding slippage losses
- Make MFI and Stochastic exit levels configurable input parameters instead of hardcoded symmetric calculations
Risk assessment
Overall risk: Medium
- Default SL/TP of 0 means no risk protection, potentially leading to unlimited losses
- Trailing stop feature is hardcoded as disabled, unable to dynamically protect profits
- No spread filter, may enter at unfavorable prices during high-volatility sessions
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
Entry_Amount | 0.01 | Entry lot size |
Stop_Loss | 0 | stop losspoints (0meansnostop loss) |
Take_Profit | 0 | take profitpoints (0meansnotake profit) |
Ind0Param0 | 42 | Williams Percent Range period |
Ind0Param1 | -20 | Williams Percent Range level |
Ind1Param0 | 20 | ADXdirection indicator period |
Ind2Param0 | 19 | Money Flow Index period |
Ind2Param1 | 79 | Money Flow Index level |
Ind3Param0 | 22 | Accelerator Oscillator level threshold |
Ind3Param1 | 16 | Stochastic %D period |
Ind3Param2 | 21 | Stochastic deceleration (slowing) |
Ind3Param3 | 20 | stochasticindicator level |
Magic_Number | 47140543 | Magic number |
Similar Momentum EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.