Categories

Knoxville Divergence Indicator MT4
Plain momentum divergence throws a lot of false signals. The Knoxville Divergence indicator narrows that down by requiring a second confirmation: RSI has to have actually reached overbought or oversold territory between the two swing points before it will draw a line. Download it below and drop it directly onto your price chart — unlike…
Download the Knoxville Divergence Indicator MT4Plain momentum divergence throws a lot of false signals. The Knoxville Divergence indicator narrows that down by requiring a second confirmation: RSI has to have actually reached overbought or oversold territory between the two swing points before it will draw a line. Download it below and drop it directly onto your price chart — unlike most divergence tools, it draws on the candles themselves rather than in a separate window.
What Is Knoxville Divergence?
Knoxville Divergence is a chart-window indicator that runs once per new bar close and scans up to LookbackCandles bars back (2,000 by default) to identify swing pivot highs and lows — a bar counts as a pivot high if its High is greater than both immediate neighbors, and a pivot low if its Low is lower than both neighbors.
It then walks through consecutive pivot highs looking for a specific pattern: price making a higher high from one pivot to the next, while the Momentum indicator (MomentumPeriod, MomentumPrice) makes a lower high over the same two points — classic bearish momentum divergence. Before drawing anything, it also checks that RSI(RSIPeriod, RSIPrice) crossed above RSIBearLimit somewhere between those two pivots. Only if both conditions are true does it draw a maroon trend line connecting the two pivot highs directly on the price chart. The mirror case runs on pivot lows: price making a lower low while Momentum makes a higher low, with RSI required to have dropped below RSIBullLimit somewhere in between, drawn as a dark green line.
Key Features
- Dual-confirmation divergence — combines a Momentum divergence check against price with an RSI overbought/oversold filter, rather than relying on momentum divergence alone.
- Drawn directly on price — trend lines connect the actual swing highs and lows on the candlestick chart, so you never have to cross-reference a separate oscillator window.
- Adjustable lookback — LookbackCandles controls how far back (up to 2,000 candles by default) the indicator scans for qualifying pivot pairs.
- Configurable Momentum and RSI settings — MomentumPeriod, RSIPeriod, and the applied price for each can be tuned independently of the divergence detection itself.
- Adjustable RSI thresholds — RSIBearLimit (default 70.0) and RSIBullLimit (default 30.0) control how strict the overbought/oversold confirmation filter is.
- Bar-close calculation only — the entire scan runs once per new bar via an internal isNewBar() check, not on every tick, and automatically clears and redraws its own lines as new pivots form.
How to Use It
Copy the compiled indicator into MQL4/Indicators, restart or refresh MetaTrader, and drag it onto a chart — it attaches to the main price window. LookbackCandles can be left at 2,000 for a full scan of chart history, or lowered if you only care about recent swings and want to reduce the number of lines drawn.
Adjust MomentumPeriod and RSIPeriod to match how sensitive you want the underlying calculations to be, and tighten or loosen RSIBearLimit/RSIBullLimit depending on how strict you want the overbought/oversold confirmation to be — pulling RSIBearLimit down from 70 or pushing RSIBullLimit up from 30 will produce more divergence lines, at the cost of some quality.
Reading it is straightforward: a fresh maroon line connecting two swing highs means price pushed to a new high while momentum weakened and RSI had reached overbought somewhere in between — treat it as a warning that the current up-move may be running out of steam. A dark green line connecting two swing lows is the mirror bullish signal. Because lines are only drawn between confirmed, closed-bar pivots, what you see is the completed pattern, not a live prediction that might vanish.
Best Timeframes / Best Use Cases
Because LookbackCandles, MomentumPeriod, and RSIPeriod are all adjustable, the indicator can be scaled to intraday charts or higher timeframes alike. Pivot-based divergence patterns naturally take a number of bars to complete on either side, so it reads best on charts where you’re willing to wait for a full swing to form rather than reacting tick by tick.
Final Thoughts
The RSI confirmation layer is what separates this from a generic momentum-divergence script — it filters out a lot of the weak divergence patterns that plain Momentum-vs-price comparisons tend to flag. If you already watch for divergence manually, this automates the pattern-spotting while keeping the confirmation logic transparent in the code itself.
- LookbackCandles (default 2000) — How many bars back the indicator scans when searching for pivot highs and lows.
- MomentumPeriod (default 20) — Period of the Momentum indicator used to detect momentum divergence against price at each pivot pair.
- MomentumPrice (default PRICE_CLOSE) — Applied price used in the Momentum calculation.
- RSIPeriod (default 21) — Period of the RSI used as the overbought/oversold confirmation filter.
- RSIPrice (default PRICE_CLOSE) — Applied price used in the RSI calculation.
- RSIBearLimit (default 70.0) — RSI must rise above this level somewhere between two pivot highs for a bearish divergence line to be drawn.
- RSIBullLimit (default 30.0) — RSI must fall below this level somewhere between two pivot lows for a bullish divergence line to be drawn.
FAQs About the MT4 Knoxville Divergence Indicator MT4
Does Knoxville Divergence plot in a separate window?
No. It’s a chart-window indicator — every trend line it draws connects points directly on the price candles, not on a separate oscillator subwindow.
What makes this different from plain Momentum divergence?
It requires a second confirmation: RSI must have actually crossed into overbought (above RSIBearLimit) or oversold (below RSIBullLimit) territory between the two pivot points before a line is drawn, filtering out weaker divergence patterns.
Does it repaint?
No. The indicator only recalculates once per new bar close, and its pivot-scanning logic never references the currently forming bar, so lines drawn between confirmed pivots don’t move or disappear later.
What do the maroon and dark green lines mean?
Maroon lines mark bearish divergence between two pivot highs (price higher, momentum weaker, RSI confirmed overbought in between). Dark green lines mark the mirror bullish divergence between two pivot lows.
Will a large LookbackCandles value slow down my chart?
It can on lower timeframes with very long history, since the indicator rescans the specified number of candles for pivots each time a new bar forms. Lower LookbackCandles if you only need recent swings.
Can I make the RSI filter stricter or looser?
Yes, via RSIBearLimit and RSIBullLimit. Raising RSIBearLimit above 70 or lowering RSIBullLimit below 30 makes the confirmation stricter and produces fewer, higher-conviction lines.
