VHF-Adaptive, Digital Kahler Variety RSI w/ Dynamic Zones [Loxx]

VHF-Adaptive, Digital Kahler Variety RSI w/ Dynamic Zones is an RSI indicator with adaptive inputs, Digital Kahler filtering, and Dynamic Zones. This indicator uses a Vertical Horizontal Filter for calculating the adaptive period inputs and allows the user to select from 7 different types of RSI .

What is VHF Adaptive Cycle?
Vertical Horizontal Filter (VHF) was created by Adam White to identify trending and ranging markets. VHF measures the level of trend activity, similar to ADX DI. Vertical Horizontal Filter does not, itself, generate trading signals, but determines whether signals are taken from trend or momentum indicators. Using this trend information, one is then able to derive an average cycle length.

What is Digital Kahler?
From Philipp Kahler's article for www.traders-mag.com, August 2008. "A Classic Indicator in a New Suit: Digital Stochastic"

Digital Indicators
Whenever you study the development of trading systems in particular, you will be struck in an extremely unpleasant way by the seemingly unmotivated indentations and changes in direction of each indicator. An experienced trader can recognise many false signals of the indicator on the basis of his solid background; a stupid trading system usually falls into any trap offered by the unclear indicator course. This is what motivated me to improve even further this and other indicators with the help of a relatively simple procedure. The goal of this development is to be able to use this indicator in a trading system with as few additional conditions as possible. Discretionary traders will likewise be happy about this clear course, which is not nerve-racking and makes concentrating on the essential elements of trading possible.

How Is It Done?
The digital stochastic is a child of the original indicator. We owe a debt of gratitude to George Lane for his idea to design an indicator which describes the position of the current price within the high-low range of the historical price movement. My contribution to this indicator is the changed pattern which improves the quality of the signal without generating too long delays in giving signals. The trick used to generate this “digital” behavior of the indicator. It can be used with most oscillators like RSI or CCI .

First of all, the original is looked at. The indicator always moves between 0 and 100. The precise position of the indicator or its course relative to the trigger line are of no interest to me, I would just like to know whether the indicator is quoted below or above the value 50. This is tantamount to the question of whether the market is just trading above or below the middle of the high-low range of the past few days. If the market trades in the upper half of its high-low range, then the digital stochastic is given the value 1; if the original stochastic is below 50, then the value –1 is given. This leads to a sequence of 1/-1 values – the digital core of the new indicator. These values are subsequently smoothed by means of a short exponential moving average . This way minor false signals are eliminated and the indicator is given its typical form.

What are Dynamic Zones?
As explained in "Stocks & Commodities V15:7 (306-310): Dynamic Zones by Leo Zamansky, Ph .D., and David Stendahl"

Most indicators use a fixed zone for buy and sell signals. Here’ s a concept based on zones that are responsive to past levels of the indicator.

One approach to active investing employs the use of oscillators to exploit tradable market trends. This investing style follows a very simple form of logic: Enter the market only when an oscillator has moved far above or below traditional trading lev- els. However, these oscillator- driven systems lack the ability to evolve with the market because they use fixed buy and sell zones. Traders typically use one set of buy and sell zones for a bull market and substantially different zones for a bear market. And therein lies the problem.

Once traders begin introducing their market opinions into trading equations, by changing the zones, they negate the system’s mechanical nature. The objective is to have a system automatically define its own buy and sell zones and thereby profitably trade in any market — bull or bear. Dynamic zones offer a solution to the problem of fixed buy and sell zones for any oscillator-driven system.

An indicator’s extreme levels can be quantified using statistical methods. These extreme levels are calculated for a certain period and serve as the buy and sell zones for a trading system. The repetition of this statistical process for every value of the indicator creates values that become the dynamic zones. The zones are calculated in such a way that the probability of the indicator value rising above, or falling below, the dynamic zones is equal to a given probability input set by the trader.

To better understand dynamic zones, let's first describe them mathematically and then explain their use. The dynamic zones definition:

Find V such that:
For dynamic zone buy: P{X <= V}=P1
For dynamic zone sell: P{X >= V}=P2

where P1 and P2 are the probabilities set by the trader, X is the value of the indicator for the selected period and V represents the value of the dynamic zone.

The probability input P1 and P2 can be adjusted by the trader to encompass as much or as little data as the trader would like. The smaller the probability, the fewer data values above and below the dynamic zones. This translates into a wider range between the buy and sell zones. If a 10% probability is used for P1 and P2, only those data values that make up the top 10% and bottom 10% for an indicator are used in the construction of the zones. Of the values, 80% will fall between the two extreme levels. Because dynamic zone levels are penetrated so infrequently, when this happens, traders know that the market has truly moved into overbought or oversold territory.

Calculating the Dynamic Zones

The algorithm for the dynamic zones is a series of steps. First, decide the value of the lookback period t. Next, decide the value of the probability Pbuy for buy zone and value of the probability Psell for the sell zone.

For i=1, to the last lookback period, build the distribution f(x) of the price during the lookback period i. Then find the value Vi1 such that the probability of the price less than or equal to Vi1 during the lookback period i is equal to Pbuy. Find the value Vi2 such that the probability of the price greater or equal to Vi2 during the lookback period i is equal to Psell. The sequence of Vi1 for all periods gives the buy zone. The sequence of Vi2 for all periods gives the sell zone.

In the algorithm description, we have: Build the distribution f(x) of the price during the lookback period i. The distribution here is empirical namely, how many times a given value of x appeared during the lookback period. The problem is to find such x that the probability of a price being greater or equal to x will be equal to a probability selected by the user. Probability is the area under the distribution curve. The task is to find such value of x that the area under the distribution curve to the right of x will be equal to the probability selected by the user. That x is the dynamic zone.

  • Bar coloring
  • 4 signal types
  • Alerts
  • Loxx's Expanded Source Types
  • Loxx's Moving Averages
  • Loxx's Variety RSI
  • Loxx's Dynamic Zones

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?