OPEN-SOURCE SCRIPT

+ 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!)
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)
barcolorCandlestick analysisDivergencejurikmajuriksmoothkdjMomentum OscillatorsMoving AveragesnononsenseforexnononsensefxOscillators

نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الرمز في المنشور يخضع لقواعد‎‎قوانين الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟


يعمل أيضًا:

إخلاء المسؤولية