KDJ Indicator

Here you can post and download custom indicators. PLEASE: Do not start topics unless you are posting your own indicator, they will be moved to appropriate section even if you do.

KDJ Indicator

K line is :
K = ((Current Close – Lowest Low) / (Highest high – Lowest low))* 100

D is simple moving average of the K line. Usually D is 3 day simple moving average of K line but it depends on what trader wants to choose. We have used exponential average.
D = N day simple moving average of K line

‘J’ is the divergence of ‘D’ value from the ‘K’ value.
J = (3*D) – (2*K)

An example of a strategy rules:

Buy – When ‘J’ line crosses above the 50 mark
Sell – When the ‘J’ line crosses below the 50 mark

KDJ.lua

KDJ Averages.lua

Averages indicator can be found here.
viewtopic.php?f=17&t=2430&hilit=averages

The indicator was revised and updated
Alexander.Gettinger
FXCodeBase: Confirmed User

Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: KDJ Indicator

Thanks very much. It's really useful.
Moreover, seems the J value calculated by the indicator is incorrect. J =3*K-2*D, but in lua file it's 3*D-2K.....
leonala

Posts: 6
Joined: Wed May 11, 2011 12:22 am

Re: KDJ Indicator

I checked.
The formula is same.

Mq4
percentJ[i] = 3 * percentD[i] - 2 * percentK[i];

Lua
buff_J[period]=3.*buff_D[period]-2.*buff_K[period];

Apprentice
FXCodeBase: Confirmed User

Posts: 29946
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: KDJ Indicator

I misunderstand the definition of J value, both of 3K-2D and 3D-2K are okay, and the accuracy of each one depends on market.
Thanks again.
leonala

Posts: 6
Joined: Wed May 11, 2011 12:22 am

Re: KDJ Indicator

Indicator was revised and updated.

Apprentice
FXCodeBase: Confirmed User

Posts: 29946
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: KDJ Indicator

dear apprentice:
the indicator works abnormally. the reason is that the formula given is incorrect. will yoou please revise the indicator again? following this formula:

RSV = ((Current Close – Lowest Low<in 9 periods>) / (Highest high<9> – Lowest low<9>))* 100

K line is 3 periods simple averrage of the RSV data .
K = N day simple moving average of RSV

D line is simple moving average of the K line. Usually D is 3 day simple moving average of K line depends on what trader wants to choose.
D = N day simple moving average of K line

‘J’ line is the divergence of ‘D’ value from the ‘K’ value.
J = (3*K) – (2*D)
weijing

Posts: 5
Joined: Thu Mar 19, 2020 5:28 am

Re: KDJ Indicator

Development reference 612.

Apprentice
FXCodeBase: Confirmed User

Posts: 29946
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: KDJ Indicator

Apprentice
FXCodeBase: Confirmed User

Posts: 29946
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia