KDJ

WickFlair

New member
back with another request... the KDJ! Been watching this on TView with $SPY and it gives good signals and i like that the backgound changes colors with the current trend
Can you port to TOS please?

//
// @author iamaltcoin
//
// 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", shorttitle="GM_V2_KDJ")
ilong = input(9, title="period")
isig = input(3, title="signal")

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 = bcwsma(RSV, isig, 1)
pD = bcwsma(pK, isig, 1)
pJ = 3 * pK-2 * pD

plot(pK, color=orange)
plot(pD, color=lime)
plot(pJ, color=fuchsia)

bgcolor(pJ>pD? green : red, transp=70)
 
Here you go:

Code:
input KPeriod = 14;
input DPeriod = 5;
input priceH = high;
input priceL = low;
input priceC = close;
input slowing_period = 5;
input over_bought = 80;
input over_sold = 20;
input averageType = AverageType.Exponential;

def lowest_k = Lowest(priceL, KPeriod);
def c1 = priceC - lowest_k;
def c2 = Highest(priceH, KPeriod) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;

plot FullK = MovingAverage(averageType, FastK, slowing_period);
plot FullD = MovingAverage(averageType, FullK, DPeriod);
plot FullJ = (3 * FullD) - (2 * FullK);

FullK.SetdefaultColor(Color.Blue);
FullD.SetDefaultColor(Color.Red);
FullJ.SetDefaultColor(Color.Green);
 
Top