# + JMA KDJ with RSI OB/OS Signals

So, what is the KDJ indicator? If you're familiar with the Stochastic , then you'll know that the two oscillating lines are called the 'K' and 'D' lines. Now you know that this is some sort of implementation of the Stochastic . But, then, what is the J? The 'J' is simply the measure of convergence/divergence of the 'K' and 'D' lines, and the 'J' crossing the 'K' and 'D' lines is representational of the 'K' and 'D' lines themselves crossing. Is this an improvement over simply using the Stochastic as it is? Beats me. I don't use the Stochastic . I stumbled upon the KDJ while surfing around the web, and it sounded cool, so I thought I'd look at it. I do like it a bit more as the 'J' line being far overextended from the other two (usually into overbought/sold territory) does give a clear visual representation of the divergence of the 'K' and 'D' lines, which you might not notice otherwise. So, from that perspective I suppose it is nicer.

But let's get to the good stuff now, shall we? What did I do here?

Well, first thing you're wondering is why there are only two lines when based on my explanation (or your previous experience with the indicator) there should be three. I found this script here on TV, by x4random, who took the 'K' and 'D' lines and made an average of them, so there is only one line instead of the two. So, fewer lines on the indicator, but still the same usefulness. It was in older TV code, so I took it to version4 and cleaned up the code slightly. His indicator included the RSI ob/os plots, and I thought this was neat (even though the RSI being os/ob doesn't tell you much except that the trend is strong, and you should be buying pullback or selling rallies) so I kept them in. His indicator was also the most visually appealing one that I saw on here, so that attracted me too. Credit to x4random for the indicator, though.

Aside from code cleanup and adding the usual bells and whistles (which I will get to) the big thing I did here was change is RMA that he was using for the 'K' and 'D' lines to a Jurik MA's, which smooth a lot of the noise of other moving averages while maintaining responsiveness. This eliminates noise (false signals) while keeping the signals of significance. It took me a while to figure out how to substitute the JMA for the RMA, but thanks to QuantTherapy's "Jurik PPO" indicator I was able to nail down the implementation. One thing you might notice is that there is no input to change signal length. I fiddled with this for a time before sticking to using the period, instead of the signal (thus eliminating the use of the signal input altogether), length to generate the 'K' and 'D' calculations. To make any adjustments other than the period length use the Jurik Power input. You can use the phase input as well, but it has much less of an effect.

Everything else I changed is pretty much cosmetic.
Candle coloring with the option to color candles based on either the 'J' line or the 'KD' line.
color.from_gradients with color inputs to make it beautiful (this is probably my best looking indicator, imo)
plots for when crosses occur (really wish there was a way to plot these over candlesticks! If anyone has any suggestions I'd love to see!)

Enjoy!

Below is a comparison chart of my JMA implementation to the original RMA script.

You can see how much smoother the JMA version is. Both of these had the default period of 55 set, and the JMA version is using the default settings, while the original version is using a length of 3 for the signal line.
Release Notes: turned overlay set to true to false (actually erased it). Not quite sure why that wasn't bugging when I published this...
Release Notes: I just changed the amount that you can vary 'power' to tenths instead of halfs. everything else remains the same. it was something that someone else pointed out to me in another indicator I released, and it's a thing I need to change through all my indicators.
Release Notes: I've been incorporating TradingView's divergence indicator into my oscillator scripts recently.

Here you may plot divergences off of either the J or KD lines.
Release Notes: A MUCH NEEDED UPDATE!

This was one of my first scripts, and the previous versions released showed that. This is a pretty big update that actually makes the indicator, I think, make more sense while enhancing its adjustability in a way that is more intuitive.

- updated to pinescript version 5
- fixed indicator calculations a bit with the Jurik calculation. One thing I missed in the earlier iterations is that I needed to have two different periods, or lookback lengths. One for the first calculation (line 55), and the other for the JMA. I didn't have this before, and because of that the indicator didn't adjust properly. That's probably the biggest change in terms of usability. The rest is basically cosmetic.
- added couple more options for plot colors and candle colors
- changed the way the RSI overbought/sold signals plot, as before they plotted the actual overbought/sold portion of the RSI on the chart in kind of an odd way. As I was changing things here I thought this didn't make sense, and why not just plot shapes along the top and bottom of the indicator for when the RSI is overbought/sold. My thinking around the best way of using these is looking to see what happens after they disappear, because you will either see price begin to reverse, consolidate and continue (in which case you'll likely see more overbought/sold plots, or consolidate and begin to reverse.
- I think that's about it
Release Notes: - I'm an idiot... missed a some candle color inputs that were still referencing colors for the indicator itself. fixed and last update! Sorry!
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer