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.
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.
Here you may plot divergences off of either the J or KD lines.
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
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)
Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.