TradingView
ClassicScott
٢٤ آب أغسطس ٢٠٢١ ١٩:٢٣

+ JMA KDJ with RSI OB/OS Signals 

Ethereum / BitcoinBitfinex

الوصف

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!)
I think that's about it. Alerts of course.

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.

ملاحظات الأخبار

turned overlay set to true to false (actually erased it). Not quite sure why that wasn't bugging when I published this...

ملاحظات الأخبار

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.

ملاحظات الأخبار

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.

ملاحظات الأخبار

added alerts for divergences

ملاحظات الأخبار

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

ملاحظات الأخبار

- I'm an idiot... missed a some candle color inputs that were still referencing colors for the indicator itself. fixed and last update! Sorry!

ملاحظات الأخبار

I'm publishing updates to all of my indicators, so I'm just going to comment on everything here since most of the updates are common across most of my indicators.

User Non-Visible Updates (basically backend stuff that makes:
- changes in code legibility and consistency across all indicators (basically standardizing the coding across as many indicators as possible)
- implementation of libraries into my indicators; which helps significantly in doing what I typed above; which in turn will make creating any new indicators, if they are of the type to use these libraries, much simpler
- updated descriptions for all indicators, which should (it's possible I've forgotten things) reflect changes I've made recently and any I may have made in the past after first publication (this is very minor, but as I was changing so much I thought I may as well--I don't intend to update these much, if at all, in the future)

User Visible Updates:
- as I mentioned everything now uses my moving averages library and volatility bands library--this cuts down the total amount of code significantly, and has made it easier for me to add moving averages, or volatility bands to these indicators because I only had to/have to add it one time (to the library) rather than multiple times across all indicators*
- since creating these libraries I've added several new moving averages (Kaufman Adaptive, Laguerre Filter, McGinley Dynamic (doesn't work for all), and Zero-lag) to them while retaining all the previous with the exception of the UMA, which wasn't implemented consistently across all indicators anyway
- eliminated having two Bollinger Bands with different standard deviations and a fill between them in exchange for one with the band fill implementation that I use on my Donchian Channels Bands
- part of my code consistency across all indicators resulted in a much needed organization of the 'style' tab

*(affects all but the Wavetrend Oscillator, Wavetrend Oscillator Overlay, Jurik KDJ, Average Candle Bodies Range, Bollinger Bands Width, ALMA Trend Detector, Ultimate Moving Average, Donchian Channels, and Dynamic Donchian Channels)
التعليقات
ty9279650506
Is there a lag in drawing lines, can it be adjusted by modifying the parameters?
ClassicScott
@ty9279650506, If you are referring to the divergences, yes in a sense there is a lag and this is due to the nature of how the divergence indicator works. I guess a lot of people don't understand this, but it's based on pivots, or really what it is doing is defining swing highs and lows. A pivot high or low can only be defined after so many bars have printed before and after the point. You adjust that in the pivot lookback right and left inputs. Default is five. What this means is that there needs to be five bars either above or below the pivot and five bars after before it will be confirmed as a pivot, and only then will the divergence plot. If you want to wait fewer candles you can shorten either side of that, but it may print divergences differently.
owlcat_
So, I've add the indicator and to be honest I don't understand how should I use it. What means colors? And what means the violet bars directions on the bottom of the indicator. Triangles and bars on bottom / top?
It would be nice to have a guide for noobies)
ClassicScott
@owlcat_, There is a guide of sorts at the top of this page under the chart. Also, I updated the main chart image and it has a few notes on it. If that isn't enough you can message me, or google search for KDJ indicator.
Ski5iS
This is by far the best KDJ script I have come across! One should have good strategy to take advantage of this script, its brilliantly done. Thanks Scott for creating this one!
ClassicScott
@Ski5iS, Thanks so much! Really happy to hear it is helping you.
stu10507
我愛你
SugarTrader77
Congrats and thanks, well explained and really beautiful looking as well.
After playing with it, I don't find the crossover/under signals relevant, very often they notice after the fact. It's better to focus on the the overbought and oversold zones. Hope I understand it correctly.
ClassicScott
@SugarTrader77, It really depends on the period setting for the indicator. I have a pretty long period set so the KD line is to some extent going to inform whether you should be looking to go long or short, and it's probably a good idea to use it with two or three moving averages to confirm if you want to be buying or selling.

Generally speaking, yes, the J line going into overbought or oversold is a better area to be entering a trade. If it's overbought while price is in a downtrend you probably want to short. If it's oversold at any point in an uptrend you probably want to be going long. You can use the mid-line in this way too. A lot of times in strong trends the oscillator will regularly bounce around the mid-line.

You can change the quickness of the indicator by adjusting the power and the period. A shorter period will show more divergences as well.
SugarTrader77
@ClassicScott, thanks a lot for the setting ideas
المزيد