R Trend Exhaustion for MT4
- インディケータ
- バージョン: 1.0
- アクティベーション: 20
# %R Trend Exhaustion — Dual Williams %R Reversal Oscillator
**Catch the exact bar an overbought or oversold trend runs out of steam — a fast and a slow Williams %R, cross-checked, with the reversal marked for you.**
Most %R (Williams Percent Range) setups suffer from one problem: a short-period %R flags "overbought" constantly in a strong trend, so traders either ignore it or get stopped out fighting the trend too early. %R Trend Exhaustion fixes this by running **two** %R readings at once — a fast one (default 21) and a much slower one (default 112, acting like a higher-timeframe filter) — and only calling a zone "overbought" or "oversold" when **both agree**. The moment that agreement breaks, the indicator prints a reversal arrow and draws a box on your price chart showing exactly where the exhausted move happened.
## What it does
- Plots **Fast %R** and **Slow %R** in a sub-window, both on the standard -100..0 scale, so you can read short-term momentum and the longer-term regime on one oscillator.
- Optional **Average formula** blends fast and slow into a single line instead of showing two.
- **11 smoothing engines** for the %R lines: SMA, EMA, RMA, WMA, HMA, VWMA (volume-weighted), SWMA, Highlow, Linreg, Median and PercentRank — reshape responsiveness without changing the core logic.
- Highlights **overbought/oversold exhaustion zones** only when Fast and Slow %R are inside the zone together (or the blended Average, if selected).
- Prints a **reversal arrow** the instant a zone breaks: ▼ red when an overbought trend exhausts, ▲ blue when an oversold trend exhausts — the indicator's core trade trigger.
- Draws a **live box directly on the price chart** around every active overbought/oversold zone, growing while the zone is active and freezing the moment it ends — so you see exactly which candles produced the exhaustion, not just a line on an oscillator.
- Optional **zero-line (-50) cross arrows** and **Fast/Slow crossover dots** for earlier, more aggressive reads.
- **Alerts** (popup, mobile push, email) for zone start, zone break (reversal) and crossovers — each switchable independently, fired once per closed bar, non-repainting.
- Configurable exhaustion **threshold**, colors, box fill/outline and box history limit.
- Works on any symbol and timeframe. MT4 version available with identical logic and inputs.
## Why traders use it
- **Two timeframes, one filter** — the slow 112-length %R behaves like a built-in higher-timeframe check, so you stop fading strong trends on every minor overbought blip.
- **The trigger is the exit of the zone, not the entry into it** — most %R setups tell you "it's overbought" and leave you guessing when to act; this indicator tells you the moment the overbought/oversold condition is actually over.
- **The box shows you the evidence** — instead of trusting a line in a sub-window, you see the exact candles on the price chart that built up the exhausted move.
- **11 smoothing formulas** instead of being locked into one, so you can match the oscillator's feel to the instrument and timeframe you trade.
- **Non-repainting signals** — the overbought/oversold state and the reversal arrow are locked in on bar close, so what you see in backtest is what you would have seen live.
## How to trade / read signals with it
**Reading the chart at a glance:**
| What you see | What it means |
|---|---|
| Fast and Slow %R both sit above the top threshold (near 0) — a tinted box appears on the price chart | **Overbought** — the up-move is stretched; do not chase new longs, start watching for the reversal |
| Fast and Slow %R both sit below the bottom threshold (near -100) — a tinted box appears on the price chart | **Oversold** — the down-move is stretched; do not chase new shorts, start watching for the reversal |
| **▼ red arrow** prints at the top of the oscillator | Overbought zone just broke — **bearish reversal trigger** |
| **▲ blue arrow** prints at the bottom of the oscillator | Oversold zone just broke — **bullish reversal trigger** |
| Box on the price chart is still growing | Zone is still active — the move hasn't exhausted yet, don't trigger off it |
| Box just stopped growing (frozen) | Zone just ended — the reversal arrow should print on that same bar |
| Yellow triangle crossing the middle line *(optional, Zero-Line Cross)* | Momentum has left the exhaustion zone and crossed into neutral territory — confirmation, not a standalone trigger |
| Small dot where Fast and Slow lines cross *(optional, Crossovers)* | Short-term momentum is realigning with (or against) the slow line — an early heads-up, best combined with the zone/arrow signals |
**Long setup (mirror everything for shorts):**
1. **Bias:** wait for an oversold box to appear on the price chart — Fast and Slow %R both inside the bottom zone.
2. **Trigger:** enter on the **▲ bullish reversal arrow** — the bar where the oversold condition just ended.
3. **Quality check:** prefer boxes that lasted several bars over a single-bar dip — a longer box means a more genuinely exhausted move, not noise.
4. **Stop-loss:** just below the bottom edge of the oversold box (already drawn for you on the chart).
5. **Manage:** if Zero-Line Cross is enabled, a bullish cross through -50 confirms momentum has properly left the oversold zone — a good place to add or hold through a pullback.
6. **Exit:** take profit into the next overbought box, or exit on an opposing reversal arrow / alert.
**Signals to skip:**
- The moment a zone **starts** (box just appears) — that's a warning to stop entering in the trend direction, not a trigger; the trigger is the arrow when the zone **ends**.
- Reversal arrows against a strong Slow %R (112) trend — the slow length is deliberately long to act like a higher-timeframe filter; fading it while it is nowhere near its own zone is a lower-quality trade. Use the Standard formula (not Average) if you want this check to be explicit on the chart.
- Isolated crossover dots or zero-line crosses with no zone/box behind them — these are early, noisier signals meant to support the zone-based arrows, not replace them.
## Input parameters
| Parameter | Default | Description |
|---|---|---|
| **Source** | Close | Price used for the %R calculation |
| **Fast Length / Fast Smoothing** | 21 / 7 | Short-term %R period and its smoothing length |
| **Slow Length / Slow Smoothing** | 112 / 3 | Long-term %R period (acts as a higher-timeframe filter) and its smoothing length |
| **Exhaustion Threshold** | 20 | Size of the overbought/oversold zone (1–50); higher = more signals |
| **Formula** | Standard | Standard (fast & slow must agree) or Average (single blended line) |
| **Average Formula MA length** | 3 | Extra smoothing applied only to the blended Average line |
| **Smoothing Type** | EMA | SMA / EMA / RMA / WMA / HMA / VWMA / SWMA / Highlow / Linreg / Median / PercentRank |
| **Bull / Bear color** | blue / red | Reversal arrows and OB/OS box tint |
| **Fast / Slow line color** | silver / light blue | Oscillator line colors |
| **Draw Boxes on price chart** | true | Tints the overbought/oversold candle ranges directly on the chart |
| **Fill Boxes** | true | Filled tint vs. outline-only boxes |
| **Max Boxes kept on chart** | 60 | Oldest boxes are removed automatically past this count |
| **Plot Zero-Line Cross arrows** | false | Extra signal when %R crosses the -50 midline |
| **Highlight Crossovers** | false | Dot marker where Fast and Slow %R cross |
| **Notification type** | None | None / Alert / Mobile push / Email |
| **Alert switches** | OB/OS start + reversal on | Enable zone-start, reversal and crossover alerts independently |
| **Lookback** | 5000 | Bars of history recalculated on load (0 = full history) |
## Notes
- MetaTrader port of the TradingView indicator **"%R Trend Exhaustion [upslidedown]"**.
- The original's gradient (semi-transparent) OB/OS shading is approximated with solid tinted boxes that blend with your chart's actual background color, so they read correctly in both light and dark themes.
- 10 of the original's 11 alternate smoothing types are implemented from their standard definitions (including the less common HMA, VWMA, SWMA, Highlow, Linreg, Median and PercentRank). The original script's undocumented third-party "mom" smoothing type is not included, since its exact formula is not publicly available.
- Overbought/oversold state and reversal arrows are evaluated on closed bars — non-repainting, backtest-consistent.
- Lightweight: incremental calculation, no DLLs, no external dependencies.
- An MT4 version is also available with identical logic and inputs.
