Stefan Krecher: Jeddingen Divergence

The main idea is to identify a divergence between momentum and price movement. E.g. if the momentum is rising but price is going down - this is what we call a divergence. The divergence will be calculated by comparing the direction of the linear regression curve of the price with the linear regression curve of momentum.
A bearish divergence can be identified by a thick red line, a bullish divergence by a green line.
When there is a divergence, it is likeley that the current trend will change it's direction.
Looking at the chart, there are three divergences that need to get interpreted:
1) bearish divergence, RSI is overbought but MACD does not clearly indicate a trend change. Right after the divergence, price and momentum are going up. No clear signal for a sell trade
2) bearish divergence, RSI still overbought, MACD histogram peaked, MACD crossed the signal line, price and momentum are going down. Very clear constellation for a sell trade.
3) two bullish diverences, RSI is oversold, MACD crossover near the end of the second divergence, price and momentum started rising. Good constellation for a buy trade. Could act as exit signal for the beforementioned sell trade.
More information on the Jeddingen Divergence is available here:
Remove from Favorite Scripts Add to Favorite Scripts
study(title="Stefan Krecher: Jeddingen Divergence", shorttitle="Jeddingen Divergence", overlay=true)
candles = input(title="Number of candles that need to diverge", type=integer, defval=5, minval=3, maxval=10)
linregPrice = input(title="price related linear regression length", type=integer, defval=20, minval=5, maxval=50)
momLength = input(title="momentum length", type=integer, defval=10, minval=2, maxval=50)

jeddingen(series) => ((falling(series, candles)) and (rising(mom(series, momLength),candles))) or ((rising(series, candles)) and (falling(mom(series, momLength),candles)))

srcDiv = close
lrDiv = linreg(srcDiv, linregPrice, 0)

lrDivColor =if(jeddingen(lrDiv) == true)
    rising(lrDiv, candles) ? red:green
plot(lrDiv, color=lrDivColor, linewidth=4)
For AutoTrendTrader / AutoDivergence / CryptoArbitrage / TD Lines
Hi - I just released a new version of this script, that basically does the same calculations but adds the possibility to create alerts based on the divergences:
cristian.d stefcom
@stefcom, Thanks for sharing Stef
What settings do you recommend for stocks?
stefcom cristian.d
@christian.d I think it depends on the stock and it's volatility and on the timeframe you would like to use - do you have any special stocks in mind? I could play around with some setups. Would love to do more trading with stocks
cristian.d stefcom
I day (5 min or 1 min TF) trade high optionable stocks/indices, but mainly SPY, AAPL and FB. SPY is the one that I would like to try your indicator on. It looks good overall, just was curious how can I improve settings. As you can see, half of the signals were goo, half, not so good. Besides your recommended momentum indicators, is here something that can be changed in settings? You help is much appreciated. Danke :)
stefcom cristian.d
I have a TradingView strategy script that uses the Jeddingen Divergence algorithm, maybe I'll release this is the near future. I use RSI and MACD as confirmation, e.g. if there is a divergence AND RSI is above a certain level AND the MACD histogram is above a certain level AND the MACD histogram has peaked - then a trade can be executed,
To adapt the strategy to a special asset/ TF I would play with the RSI and MACD histogram levels, and maybe with the properties that relate to the divergence (e.g. how long must price and momentum diverge?).
I'll come back to SPY later this week. Schönen Abend noch ;-)
stefcom cristian.d
Hi Christian, I revisited your SPY example and came up with a simple solution: In case of a bullish divergence you draw a trendline above price, in case of a bearish divergence you need to draw it under the price. A buy/ sell signal will be triggered only when price breaks the trendline.
I draw some very basic trendlines with an online drawing program - have a look at it here:
This is based upon Rob Bookers Trifecta system looking at trendline breaks after a Knoxville Divergence.
cristian.d stefcom
Vielen dank Stef ! Also some of the buy signals came on obvious tops, so yeah.. Again thank you!
cristian.d stefcom
How do you draw with dropbox? Is it automatically drawn?
stefcom cristian.d
I just downloaded your chart as an image file and edited it with an online image manipulation tool. I just draw some lines on it, only to illustrate the idea of trendline breaks after a Jeddingen Divergence. Then saved the image and shared it via Dropbox - no automagic ...
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
HE עברית
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Get Help Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing Get Help Ideas Published Followers Following Private Messages Chat Sign Out