J.S.

KDJ

1231 views
44
KDJ indicator
Remove from Favorite Scripts Add to Favorite Scripts
study("KDJ Indicator")
// KDJ Indicator, Rev 03
//
// Rewrite for Tradingview "Pine Script" by Kocurekc, April 2014
// https://getsatisfaction.com/tradingview/
// https://www.tradingview.com/u/kocurekc/
// Code is provided as public domain, no warranty
 
lenL = input(title="Lookback Period, Long", type=integer, defval=14, minval=2)
lenS = input(title="Lookback Period, Short", type=integer, defval=5, minval=2)
bE = input(title="Use EMA?", type=bool, defval=true)
bJ = input(title="Smooth the %J?", type=bool, defval=false)
lenJ = input(title="%J Smoothing", type=integer, defval=5, minval=1)
 
s = stoch(close, high, low, lenL)
pK = bE ? ema(s,5) : sma(s,5)
pD = bE ? ema(pK, lenS) : sma(pK, lenS)
pJ = (3 * pD) - (2 * pK)
 
plot(pK, color=blue)
plot(pD, color=red)
plot(bJ ? sma(pJ,lenJ) : pJ, color=green)

Comments

Thanks for posting this, link back to the original post,


This indicator was originally noted in the tradingview help forums. Noted from "Google's Finance Site," but they use a modified (using EMA instead of traditional SMA) slow stochastic with the %J equation (%J =3 * D – 2 * K ). I can't find any references to the origins of the %J equation, but it is noted in several other online sites.
https://getsatisfaction.com/tradingview/topics/pine_script_for_kdj_indicator

The basic foundation of the code is still the %J equation. I've included an option to use either the EMA (default) and the SMA (more traditional slow stochastic). You can also adjust the lookback period, %D smoothing, and I've included the option to smooth the %J. This last option slows the indicator down a little, but really cuts out the choppiness of the %J crossings.
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out