Editor's Picks
OPEN-SOURCE SCRIPT
Aktualisiert

+ Klinger Oscillator

60 617
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.
Snapshot

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)
Versionshinweise
Lots of updates.
- updated to pine v6
- brought code more inline with TV's recommendations
- added switch operators for all the moving averages and bands/channel, which cuts out many lines of code
- added a higher timeframe color reference. See the tooltip. Ask me questions.
- just like my %UMA, I've eliminated color.gradient colors in an effort to clean up the Inputs UI for everyone. There are no longer any color inputs. Just access those through the Style tab. Eliminating color.gradient was necessary to achieve this. Sorry to anyone who really loved their gradient colors. On the other hand this eliminates two different options, of the original six, of coloring the indicator and bars. Just an overall simplification for everyone, and newer users in particular.
- removed the check for showing or not showing the standard Klinger Osc. This is replaced by one for making it smoothed. There is a tooltip for this, but basically by smoothing it, i.e. using what was originally just named the signal line (or primary signal line) the original KVO is turned off. Sounds kinda the same, but this came in useful when adjusting code throughout the rest of the indicator. So, there is now the KVO, a smoothed KVO, and a signal line (that being the secondary one of the previous version). These name changes occurred because I'm betting most people use a smoothed version and maybe a signal line on that, and I wanted the names of these things to reflect that. It is always problematic to name things that can have multiple functions, but, you know, gotta figure out what you think is best/most sensible and go with it.
- updated to the newest version of the divergences code by TradingView

I think that's everything! As always,

Enjoy!
Versionshinweise
I know I just updated this but I realized I had the alerts for divergences grey'd out because I was getting a compiling error while working on them yesterday, and when I published I forgot to re-enable them after finding a fix.

I also just set 'use smoothed' to default because I think it's best and makes the indicator look more appealing (everybody knows how choppy this thing looks in it's standard form).

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.