# KDJ Indicator - @iamaltcoin,modified by Yanga

347 3
KDJ Indicator - @iamaltcoin,modified by Yanga
```//
// @author bitcoinwisdom, modified by Yanga
//
// This KDJ indicator is a mimic of the same indicator on bitcoinwisdom
//
// This script is released free of charge with no warranty
// Please leave a not to the author of this script if it is used
// whole or in part
//
study("KDJ Indicator - @iamaltcoin,modified by Yanga", shorttitle="KDJ_Yanga")
ilong = input(9, title="period")
isigK = input(3, title="signal K")
isigD = input(3, title="signal D")

bcwsma(s,l,m) =>
_s = s
_l = l
_m = m
_bcwsma = (_m*_s+(_l-_m)*nz(_bcwsma[1]))/_l
_bcwsma

c = close
h = highest(high, ilong)
l = lowest(low,ilong)
RSV = 100*((c-l)/(h-l))
pK = sma(RSV, isigK)
pD = sma(pK, isigD)
pJ = 3 * pK-2 * pD

plot(pK, color=orange)
plot(pD, color=lime)
plot(pJ, color=fuchsia)
h0 = hline(80)
h1 = hline(20)
h2 = hline(100)
h3 = hline(0)
bgcolor(pJ>pD? green : red, transp=70)```
Thanks for your contribution. If this isn't too much for ask: Could you add paramaters to customize bgcolors?
On this line of code: what the slm stands for? bcwsma(s,l,m). Thanks.
syracusepro
well, s is signal, l is the length or number of periods, and m is the weighting. In principle, it is from the weighted moving average function y=(m*x+(l-m)*y')/l, where y' denotes the y value in its previous period. This code is just from the math book and also from the author bitcoinwisdom, no creative :). And here you can alternatively use the bcwsma instead of sma, or you just still use sma. This change will make curves different. Maybe could get something from this change in different cases. Hope my answer is fit your question :)
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter