TradingView
ClassicScott
14. Dez. 2021 01:00

+ Klinger Oscillator 

Bitcoin / United States DollarCoinbase

Beschreibung

This is a version of Stephen J. Klinger's, Klinger Oscillator (sometimes called Klinger Volume Oscillator). I've changed virtually nothing about the indicator itself, but added some lookback inputs for the EMAs the oscillator is derived from (traditionally 34 and 55), and added a few other things, as is my wont.

But what is the Klinger Oscillator? Essentially, the calculation looks at the high, low, and close of the current period, and compares that to the previous period's. If it is greater, it adds volume, and if it is less, it subtracts volume. It then takes an EMA of two different lookback periods of that calculation and subtracts one from the other. That's your oscillator. There is then made a signal line of the oscillator that a trader can use, in combination with the zero line, for taking trades. Investopedia has a good article on it, so if you're looking for more specifics, check there.

What I've done is add a selection of different moving averages that you may choose for the signal line. Usually it's a 13 period EMA, and that comes default, but here you could use an ALMA or HMA, or modular filter, etc. Find something that works for your style/algorithm.

Of course there are all the usual additions of mine with the various ways of coloring the indicator and candles, adjustable Donchian Bands, and alerts. A new addition that I've just added to all my indicators (oscillators, anyway) are divergences. This is more or less just a copy and paste of the divergence indicator available in TradingView. In this case you can set it to plot divergences off either the Klinger or the signal line. Depending on which one you choose you may have to adjust pivot lookbacks, and lookback range. I've kept the settings default from the RSI TradingView version.

Versionshinweise

added alerts for divergences

Versionshinweise

- updated to pinescript version 5
- added VWMA and RMA (Wilder's, or smoothed, moving average) to signal lines
- added little plots for signal line crosses
- added a 'Center Line' selection for colored candles and the oscillator, so, bullish color above center line, bearish below

Versionshinweise

so, the default source for the Klinger Oscillator is hlc3. I just only realized this while looking things over and thinking of a different implementation of it. I decided to try it using 'close' as the source, and I thought to myself that I should make the source something the user can select for his/herself. Now you can select close, hlc3, or whatever else you may want.

Versionshinweise

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.

Specific to the Klinger Oscillator I've added a second signal line so you can eliminate the og Klinger and use the primary signal line as a smoothed version of the Klinger Oscillator. This should help with eliminating false signals.

See below image for a smoothed version of the oscillator.


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)
Kommentare
PineCoders
ClassicScott
@PineCoders, thank you thank you!
pureAccount39441
emreemenekse
Thanks for sharing. Does it repaint?
ClassicScott
@emreemenekse, No. Once a candle is closed and the indicator plots what it plots, nothing in the past changes.
PineCoders
This publication is now featured in our Editors' Picks: tradingview.com/scripts/editors-picks/ .
In the name of all TradingViewers, thank you for your valuable contribution to the community, and congrats!
ClassicScott
@PineCoders, Haha, wow, I can't even believe this, considering I only half know what the heck I'm doing. This is very much appreciated all the same! I iterate on these indicators because I hope that I can provide something useful for other traders, but it has also helped me gain a greater understanding of what an indicator is saying in relation to the chart, and has in fact helped me to become a better trader.
drdgvhbh
What is the significance behind the signal line crossing the zero line? Is it a shift in the trend?
ClassicScott
@drdgvhbh, Yeah, I suppose so. But that would be a pretty delayed signal since the signal line lags the oscillator. It's more like if it stays above or below the line then the trend is in that direction. Use it with price action or moving averages on the price chart. You can think of it in that sort of way too.
robinawesome1
You have mixed up the donchian channel upper / lower band colors :)
Mehr