An EA is the one kind of download here that acts on its own: indicators describe the market, while an Expert Advisor actually trades it. This free EA trades a single, transparent mean-reversion strategy built on Williams %R: it watches for %R to snap back out of the Overbought or Oversold zone, then opens a trade with an ATR-based Stop Loss, an RR-multiple Take Profit, and a risk-based position size — all calculated automatically, with no manual chart-watching required.
How the Strategy Works
Williams %R runs on a scale that trips up a lot of traders coming from RSI or Stochastic: instead of 0-to-100, it reads 0 down to -100. A reading near 0 means price is closing right at the top of its recent range — as strong as price can look. A reading near -100 means price is closing right at the bottom of its recent range — as weak as it can look. This EA uses a 14-period Williams %R (WPRPeriod) and treats -20 as the Overbought line and -80 as the Oversold line, the same thresholds taught in the site's own Williams %R lesson, just mirrored onto the negative scale from Stochastic's familiar 80/20.
The signal the EA actually trades is not the moment %R first touches an extreme, it's the moment %R turns back out of one. A BUY setup forms when %R crosses back above -80 after having been at or below it — not the bar where price first looks oversold, but the bar where the sell-off visibly runs out of steam and momentum starts climbing again. A SELL setup is the mirror case: %R crossing back below -20 after having been at or above it. Touching an extreme only tells you the move was stretched; the cross back out is the first real evidence that the stretch is unwinding. Trading the touch itself, rather than the turn, is a common beginner mistake, and this EA is built to avoid it mechanically — it only fires on the cross-back bar.
Stop Loss, Take Profit, and Position Sizing
Every trade's Stop Loss is sized from ATR rather than a fixed pip distance: SL distance = ATR × ATRMultiplier (default 2.0, with ATRPeriod defaulting to 14). A volatile pair or session gets a wider stop automatically; a quiet one gets a tighter stop — the stop always reflects what the market is actually doing right now, rather than an arbitrary fixed number that's too tight on some pairs and too loose on others. Take Profit is then set at RiskRewardRatio (default 2.0) times that same SL distance, so every trade this EA opens carries a fixed, known risk-to-reward ratio, win or lose, regardless of how wide or narrow the ATR-based stop happens to be on that particular trade.
Position size is calculated the same way it's taught in Risk Management Basics: RiskPercent (default 1.0%) of account balance, divided by the Stop Loss distance (converted through the symbol's tick value and normalized to the broker's lot step), gives a lot size where a losing trade costs roughly the same fraction of the account no matter how wide or narrow that particular Stop Loss happens to be. If you'd rather run a fixed size no matter the balance or stop width, enable UseFixedLot and the flat FixedLotSize takes over.
Entry Conditions
- BUY — Williams %R crosses from at or below -80 (Oversold) on the previous bar to above -80 on the current bar.
- SELL — Williams %R crosses from at or above -20 (Overbought) on the previous bar to below -20 on the current bar.
On top of the signal itself, the same safety mechanics every EA on this site relies on keep it well-behaved on a live account. Only one position at a time is allowed: the EA counts its own open trades (by symbol and magic number) and ignores any new signal while one exists. Every order it places is tagged with its own magic number (20260724), so it never touches trades opened manually or by a different EA sharing the same chart or account. It evaluates entry logic once per new bar only, tracking the timestamp of the last bar it processed, rather than re-checking on every incoming tick — without this, a single %R cross could otherwise fire the same signal dozens of times before the bar closes. And before opening anything, it checks the current spread against MaxSpreadPoints, skipping the entry if the market is too illiquid at that moment.
Parameters
- WPRPeriod (default 14) — the lookback period for the Williams %R calculation; shorter reacts faster and crosses zones more often, longer is smoother and more selective.
- Overbought (default -20.0) — the upper threshold on the -100-to-0 scale; a SELL fires when %R crosses back below this level.
- Oversold (default -80.0) — the lower threshold on the -100-to-0 scale; a BUY fires when %R crosses back above this level.
The other inputs are the site's standard risk engine (ATRPeriod, ATRMultiplier, RiskRewardRatio, RiskPercent, UseFixedLot, FixedLotSize, MaxSpreadPoints, EnableTrading, MagicNumber), and each default is explained once in the risk-engine section of the EA hub. This EA's own magic number is 20260724.
Why Williams %R Instead of RSI for This Strategy
This site also ships an RSI-based reversal EA that trades the exact same idea — a cross back out of an extreme zone — so it's worth being precise about what actually changes when the oscillator underneath is Williams %R instead. RSI smooths its calculation over its lookback period, which damps noise but also lags a little before it signals a turn. Williams %R uses the same kind of highest-high/lowest-low range calculation as Stochastic but applies no smoothing at all, so it tends to reach its extremes and turn back out of them slightly earlier than RSI does on the same data. That speed is the whole trade-off: an earlier signal means an earlier entry (and a comparatively smaller move already spent by the time this EA reacts), but it also means more of the raw noise in price action reaches the entry logic unfiltered, so a wider ATR-based stop and a strict one-position-at-a-time rule matter more here than they might on a slower oscillator.
The -20/-80 thresholds aren't arbitrary either — they mirror Stochastic's 80/20 zones, just flipped onto %R's negative scale, and they mark the outer fifth of the indicator's range on each side, which is roughly how far price needs to stretch within its recent high-low range before a bounce becomes statistically interesting rather than routine noise. A WPRPeriod of 14 is the same convention Larry Williams originally used and the default most trading platforms ship with, which keeps the EA's behavior easy to reason about and easy to compare against how the indicator is taught elsewhere on this site.
A Word of Caution
Before funding it with real money, let it run on demo across several market regimes; no backtest or live record ever guarantees what comes next. There is no rule set, manual or robotic, that avoids losses — this EA will have losing trades. Mean-reversion EAs like this one are built on the assumption that an extreme reading snaps back toward the middle, and that assumption breaks down badly in a strong, sustained trend: Williams %R can pin near -100 for an extended stretch while price keeps grinding lower bar after bar, and this EA's "turn back above -80" signal can fire on nothing more than a brief pause before the downtrend resumes — a classic falling-knife entry that stops out as price simply continues rather than reverting. There is no trend filter built into this version; consider pairing it with a manual read of trend vs range conditions, or restricting it to pairs and timeframes known to chop rather than trend, before relying on it in a strong directional market. Everything is distributed as source code: review it line by line, and don't run anything whose parameters you can't explain. All of this is educational material; none of it is advice about what you personally should trade.