Exp_WPR_Histogram
This EA trades based on the WPR (Williams' Percent Range) Histogram indicator, opening buy positions when the histogram shows bullish momentum above the high level and sell positions when it shows bearish momentum below the low level. It uses a custom WPR_Histogram indicator with configurable overbought/oversold levels and signal bar selection, combined with money management modes for position sizing. Trade exits are triggered by opposing signals from the histogram.
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 | +4.27% | +3.70% | 4.40% | 15 | 42.90% | 0.76 | 0.97 | 3 | +$25.62 | Reliable |
| GBPUSD | -2.25% | -1.96% | 8.15% | 23 | 31.80% | -0.26 | -0.28 | 6 | −$9.55 | Reliable |
| USDJPY | -7.93% | -6.93% | 9.62% | 36 | 25.70% | -1.18 | -0.82 | 7 | −$23.03 | Reliable |
| XAUUSD | -90.78% | -86.05% | 96.36% | 40 | 32.50% | -1.76 | -0.94 | 5 | −$226.96 | Account stopped out |
Profitable on 1 of 4 markets with reliable results.
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.
Against the other Momentum EAs with a reliable result on the same market: EURUSD: better than 81% of 68 · GBPUSD: better than 39% of 66 · USDJPY: better than 3% of 68 · XAUUSD: better than 29% of 75
Month by month
| Market | Months with a gain | Best month | Worst month |
|---|---|---|---|
| EURUSD | 54% | +2.81% 2026-09 | -1.94% 2026-04 |
| GBPUSD | 31% | +3.77% 2026-02 | -2.84% 2026-01 |
| USDJPY | 31% | +1.21% 2026-07 | -2.23% 2026-02 |
| XAUUSD | 0% | 0.00% 2026-03 | -83.93% 2026-02 |
From the backtest equity curve, sampled about every two days; only reliable results.
Blow-up risk: High
- Hit a stop-out in our backtest (equity below 10%) on XAUUSD
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
This strategy trades momentum based on a histogram variant of the Williams' Percent Range (WPR) indicator. Entry conditions: a buy signal is generated when the histogram color buffer (buffer 2) equals 0 and the histogram value (buffer 0) is greater than 0, indicating bullish momentum above the overbought threshold; a sell signal is generated when buffer 2 equals 2 and the histogram value is less than 2, indicating bearish momentum below the oversold threshold. Exit conditions: an opposing signal triggers position closure — a buy signal closes sell positions (SELL_Close=true) and a sell signal closes buy positions (BUY_Close=true), implementing a signal-reversal exit model. Position sizing is controlled via the MM parameter and MMMode enumeration, supporting five modes: free margin-based, balance-based, loss-adjusted free margin, loss-adjusted balance, and fixed lot size. Money management features stop loss and take profit defaults of 1000 and 2000 points respectively, providing substantial room for price fluctuation. The strategy uses the SignalBar parameter to determine which bar to read signals from, defaulting to the previous closed bar (value=1), which avoids signal repaint issues from unclosed bars.
Strengths
- Uses closed bar signal (SignalBar=1) to avoid signal repainting, improving signal reliability
- Provides complete buy/sell open and close toggle switches with high flexibility for directional control
- Built-in five money management modes to accommodate different risk preferences and account sizes
- Includes new bar detection mechanism (IsNewBar) to prevent repeated entries within the same bar
- Complete stop loss and take profit parameters providing a basic risk control framework
Weaknesses
- No spread filter, which can lead to unfavorable entry prices during high spread conditions, especially impactful for short-term trading
- Lacks position checking logic, potentially opening duplicate positions in the same direction when one already exists
- Stop loss of 1000 points and take profit of 2000 points are excessively large, potentially preventing timely exits in low-volatility markets
- Depends on custom WPR_Histogram indicator — if the indicator file is missing, the EA fails with insufficient error handling
- No trailing stop functionality to lock in floating profits after favorable price movement
Possible improvements
- Add a spread filter to pause new entries when spread exceeds a configurable threshold, avoiding unfavorable slippage
- Add position checking logic before opening trades to confirm no existing same-direction positions, preventing duplicate entries
- Implement a trailing stop feature to automatically adjust stop loss when price moves favorably, locking in profits
Risk assessment
Overall risk: Medium
- No spread filter — widened spreads during high volatility periods can cause unnecessary losing entries
- No position check — potentially building excessive exposure by opening duplicate same-direction positions
- Fixed stop loss and take profit in points, not dynamically adjusted based on market volatility (ATR)
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
MM | 0.1 | Margin usage ratio for lot size calculation |
MMMode | LOT | Position sizing mode (free margin/balance/net loss/fixed lots) |
StopLoss_ | 1000 | Stop loss in points |
TakeProfit_ | 2000 | Take profit in points |
Deviation_ | 10 | Maximum allowed slippage in points |
BuyPosOpen | true | Allow buy positions |
SellPosOpen | true | Allow sell positions |
BuyPosClose | true | Allow close buy positions |
SellPosClose | true | Allow close sell positions |
InpInd_Timeframe | PERIOD_H4 | Indicator calculation timeframe |
WPRPeriod | 14 | Williams %R period |
HighLevel | -30 | Overbought level line |
LowLevel | -70 | Oversold level line |
SignalBar | 1 | Bar index for signal (0=current bar) |
Similar Momentum EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.