farzinsabbagh

KDJ stochastic indicator

This is a special calculation of KDJ indicator. As you may know this is based on stochastic indicator. Stochastic indicator is a method to normalize a trending time serie (here price). the calculation of stochastic itself is a built in function in pine but it is straight forward:
In sudo code:
RSV for n days=(Cn-Ln)/(Hn-Ln)×100
In which, Cn is the closing price on the nth day; Ln is the lowest price in n days; Hn is the highest price in n days.
To calculate other indices K, D and J we use this formulas:
K = (2/3) * K + (1/3) * RSV
D = (2/3) * D + (1/3) * K
J = 3 * K - 2 * D
As you can see it is a recursive calculation. It means any value of the indices are affected by it's own previous value (and I'm passionate about recursive functions!) It may concern you that in the initial calculation there is no previous value and you are right. For the initial values we use value of 50 because it is an oscillator and the mean value is always 50 so we replace the first NAs with 50 using nz() function in pine.
After doing this calculations we reach to the smoothing section. I used simple moving averages, you may replace it with other more advanced smoothing techniqes like EMA or ALMA.
After I wrote this indicator I saw that it is a good indicator for reading divergences. As you can see I showed couple of these divergences to you on the chart. Notice that I analyzed divergence between price and J (very light green) line and not to K or D. I really appreciate any suggestion on this indicator and hope to improve it. The other ones present in the public library wasn't good and they differ a lot in the calculation and also the graphics doesn't look good.
Be free to change the parameter i saw these parameter are good to daily Bitcoin chart.
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?