Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.
What Is This Strategy?
The Ultimate Oscillator Reversal is a trend-pullback swing strategy built around Larry Williams' Ultimate Oscillator (UO) — a momentum indicator that measures buying pressure — combined with an Exponential Moving Average (EMA) trend filter. Rather than trying to catch every top and bottom, it looks for temporary dips inside an established uptrend (or temporary bounces inside a downtrend) and signals an entry when momentum resets in the direction of the larger trend.
The Ultimate Oscillator is designed to reduce the false signals that plague single-period momentum tools. Most oscillators react to just one lookback window, so a single sharp candle can whip them from oversold to overbought and back. The UO instead blends buying pressure across three lookback windows — a short, a mid, and a long period — and weights them 4:2:1. This smoothing means a lone spike is far less likely to produce a misleading extreme reading. The oscillator moves on a 0–100 scale, where low values suggest sellers are stretched and high values suggest buyers are stretched.
This strategy is best suited to traders who want to study how a momentum oscillator behaves when it is filtered by trend context. It is a learning tool for understanding "buy the dip in an uptrend" logic, volatility-scaled risk, and the difference between fading a trend blindly versus trading pullbacks that align with prevailing order flow. It is not a shortcut to results, and it is not intended to be run unattended without study.
How It Works
The strategy evaluates its rules once per newly closed bar, so it never acts on an unfinished candle. Every decision is based on completed price data.
Trend regime filter (the gate):
- The strategy calculates a trend EMA and compares its value now against its value one bar ago.
- If the EMA is rising, the strategy treats the market as an uptrend and will only consider long trades.
- If the EMA is falling, it treats the market as a downtrend and will only consider short trades.
- This slope check uses a single timeframe — there is no second chart involved.
Entry conditions:
- Long signal — the trend EMA is rising and the Ultimate Oscillator crosses up through the oversold level (its previous reading was below the level, and its current reading is at or above it). This is interpreted as a pullback within an uptrend that has finished resetting, so the strategy signals a buy on the resumption.
- Short signal — the trend EMA is falling and the Ultimate Oscillator crosses down through the overbought level (previous reading above, current reading at or below). This mirrors the long logic for a downtrend.
Exit conditions (stop-loss and take-profit):
- Risk is volatility-scaled using the Average True Range (ATR), an indicator that measures how much price typically moves per bar. This keeps the strategy symbol-agnostic — the stop adapts to how volatile the instrument currently is.
- On a long, the stop-loss is placed at the entry price minus
AtrStopMult × ATR, and the take-profit at the entry price plusAtrTargetMult × ATR. - On a short, the levels are mirrored: stop above entry, target below.
- With the default multipliers, the target distance is wider than the stop distance, giving a reward-to-risk ratio greater than 1:1 by design.
Trade management rules:
- Only one position per magic number is allowed at a time. Once a trade is open, the ATR-based stop-loss and take-profit manage the exit — the strategy does not stack or pyramid positions.
- A spread gate skips any signal if the current spread (in points) is wider than the configured maximum, helping avoid unusually costly fills.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| ShortPeriod | 7 | 3 | 15 | Short lookback window for the Ultimate Oscillator (classic value 7). |
| MidPeriod | 14 | 8 | 30 | Middle lookback window for the Ultimate Oscillator (classic value 14). |
| LongPeriod | 28 | 20 | 60 | Long lookback window for the Ultimate Oscillator (classic value 28). |
| OversoldLevel | 35.0 | 15.0 | 45.0 | UO level that, when crossed upward, arms a long trigger in an uptrend. |
| OverboughtLevel | 65.0 | 55.0 | 85.0 | UO level that, when crossed downward, arms a short trigger in a downtrend. |
| TrendEmaPeriod | 50 | 20 | 200 | Period of the trend EMA whose slope must agree with the trade direction. |
| AtrPeriod | 14 | 5 | 40 | Lookback period for the ATR used to size the stop and target. |
| AtrStopMult | 2.0 | 0.5 | 5.0 | Stop-loss distance as a multiple of ATR beyond the entry price. |
| AtrTargetMult | 3.0 | 0.5 | 8.0 | Take-profit distance as a multiple of ATR beyond the entry price. |
| MaxSpreadPoints | 30 | 1 | 200 | Skip the trade if the current spread (in points) exceeds this value. |
| Lots | 0.10 | 0.01 | 1.00 | Fixed trade volume in lots. |
| Magic | 7318 | 0 | 9,999,999 | Unique identifier so the EA manages only its own positions. |

Recommended Chart Settings
The Ultimate Oscillator Reversal was designed with a trending major currency pair such as EURUSD or GBPUSD, or an index like US500, on the M15 to H1 timeframes. These conditions suit a trend-pullback / swing style: liquid instruments that tend to trend over intraday-to-multi-hour horizons give the EMA slope filter meaningful trend context and give pullbacks room to develop.
Keep in mind that results will vary considerably across different symbols, timeframes, and market conditions. An instrument that chops sideways with no persistent trend will produce frequent conflicting EMA slope flips, which is precisely the environment this pullback logic is not built for. Always test on the specific symbol and timeframe you intend to study before drawing any conclusions.
How to Install on MetaTrader 5
- Download the
.ex5file from the link below - Copy it to your MT5
MQL5\Expertsfolder - Restart MetaTrader 5 or refresh the Navigator panel
- Drag the EA onto a chart matching the recommended symbol and timeframe
- Configure the input parameters and enable Algo Trading
What to Consider Before Using This EA
Strengths of this approach. By requiring both a momentum extreme and a same-direction trend slope, the strategy converts a coin-flip mean-reversion signal into a more disciplined "buy the dip in an uptrend" entry. The three-window Ultimate Oscillator is inherently steadier than a single-period oscillator, which historically reduces whipsaw at the extremes. The ATR-based stops and targets also make risk adapt automatically to volatility, so the same settings behave reasonably across instruments with very different price ranges.
Known limitations. No trend filter is perfect. An EMA slope can flip direction right at the moment a pullback completes, causing the strategy to miss a valid move or take a trade just as the trend stalls. Because the strategy only trades when the oscillator resets through a threshold, it can sit idle for long stretches in ranging or low-volatility markets. Oscillator-based reversals can also fire early during strong, extended trends, where the UO may reset and cross while price continues in the original direction against a fresh position.
Where it may underperform. Choppy, directionless markets tend to generate frequent EMA slope reversals and low-quality signals. Sudden news-driven volatility can blow through ATR-scaled stops before the intended structure plays out. And a single fixed lot size does not adjust to account equity, so risk per trade is not automatically kept constant. Treat this EA as a framework to study and stress-test, not a finished system to deploy unquestioned.
Risk Management Tips
- Use a demo account first. Run the strategy on a demo or paper account long enough to understand how it behaves in trending, ranging, and volatile conditions before considering any real capital.
- Risk a small, fixed fraction per trade. A common educational guideline is to risk no more than 1–2% of account equity on any single position. Because this EA uses a fixed lot size, you may need to adjust the
Lotsvalue so the ATR-based stop distance stays within that fraction for your account. - Understand drawdown. Every strategy experiences losing streaks. Study the maximum historical drawdown in your own testing so you know what a normal rough patch looks like and can size positions accordingly.
- Mind position sizing across symbols. The same lot size represents very different monetary risk on EURUSD versus an index like US500. Adjust volume per instrument.
- Keep the spread gate realistic. Setting
MaxSpreadPointstoo high can allow fills during costly, illiquid periods; setting it too low may skip otherwise valid signals. Tune it to your broker's typical spreads. - Never risk money you cannot afford to lose. Leverage magnifies both gains and losses, and no filter removes the possibility of a loss.
Risk Warning
Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.
Downloads
- Expert Advisor: UltimateOscillatorReversal.ex5 (0 downloads)
- Source Code: UltimateOscillatorReversal.mq5 (0 downloads)
- Documentation: UltimateOscillatorReversal.pdf (0 downloads)