OPEN-SOURCE SCRIPT

Extended Recursive Bands - Maximum Efficiency With Extra Options

Introducing A New Calculation For Efficient Bands Calculation !

Here it is ! The Recursive Bands Indicator, an indicator specially created to be extremely efficient, i think you already know that calculation time is extra important in algorithmic trading, and this is the principal motivation for the creation of the proposed indicator. Originally described in my paper "Pierrefeu, Alex (2019): Recursive Bands - A New Indicator For Technical Analysis", the indicator framework has been widely used in my previous uploaded indicators, however it would have been a shame to not upload it, however user experience being a major concern for me, i decided to add extra options, which explain the term "extended".

On The Indicator Calculation

You can skip this part if it doesn't interest you. The calculation of the indicator is based on recursion, but i want to explain the mathematical formula described in the paper.

snapshot

I've seen some users trying to remake it from the calculations, however there was always something weird, and i understand, mathematical notations are always a bit weird, even myself don't always write them correctly/understand them, however this one is relatively simple to understand.

First lets explain each elements of the calculation :

α = smoothing constant, or 2/(length+1)

max/min = maximum and minimum function, max return the greatest input value while min return the lowest one, for example :

max(4,2) = 4 while min(4,2) = 2

the "||" notation mean taking the absolute value, for example : |-1| = abs(-1) = 1

The calculation after the max/min function is called the correction factor, and is the core of the indicator. The last two variables are just here to provide an initial value for upper and lower, basically when we start our calculations we will assign the value of the closing price for upper and lower.

The motivation behind using a smoothing constant in range of (0,1) was to tell the reader that the indicator is easily made adaptive, this is what i did on my adaptive trailing stop indicator by using the efficiency ratio as smoothing variable, the user can use 1/length instead of the provided calculation for alpha.

If you interested on the indicator main logic, it is actually really simple, by using upper = max(price,upper) and lower = min(price,lower) we would get the maximum/minimum price value at time t, therefore upper can only be greater or equal than its precedent value, while lower can only be lower or equal than its precedent value, in order to fix that we subtract/sum upper/lower with a value, this allow the upper band to be lower than its precedent value and lower to be greater than its precedent value, this is the role of the correction factor.

The Indicator

The indicator display one upper and one lower band, every common usages applied to bands indicators such as support/resistance, breakout, trailing stop...etc, can also be applied to this one. length control how reactive the bands are, higher values of length will make the bands cross the price less often.

In order to provide more flexibility for the user i added the option to use various methods for the calculation of the indicator, therefore the indicator can use the average true range, standard deviation, average high-low range, and one totally exclusive method specially designed for this indicator.

Classic Method

This option make the indicator use its classical calculation, this is the most efficient method of all.

snapshot

Atr Method (atr)

This method use the average true range as correction factor, notice that lower values of length can still produce wide band.

snapshot

Standard Deviation Method (stdev)

This method use a biased estimate of the standard deviation as correction factor.

snapshot

The method produce smoother bands that converge more slowly toward the price in comparison with the classic correction factor.

Average High-Low Range Method (ahlr)

This method use the average of the high-low range as correction factor, extremely similar to the average true range.

snapshot

Rising Falling Volatility (rfv) Method

A new method created for this indicator, this correction factor use the absolute prices changes when price value is greater/lower than any length past values of the price, this allow to have more boxy shaped bands, work best with greater values of length.

snapshot

The bands can be in contact with this method, a possible fix in the future.

Conclusion

The recursive band indicator is one of my greatest indicators in my opinion (i would love to have yours), as you can see the idea behind it is extremely simple and allow for a super efficient band indicator, which was the original motivation behind it, in order to provide more fun for the users i also added more option for the correction factor, this allow the user to be creative and not get stuck with the original calculation.

Like the trend step indicator family we have almost ended our series on the recursive band framework, 1 more trailing stop will be added in the future, and then we'll have more "boring" stuff until i find something cool again, it shouldn't be long ;)

Thanks for reading !



bandsbreakoutefficientEnvelope (ENV)recursivetrendTrend AnalysisVolatility

Skrypt open-source

W prawdziwym duchu TradingView autor tego skryptu opublikował go jako open source, aby inwestorzy mogli go zrozumieć i zweryfikować. Pozdrowienia dla autora! Możesz go używać bezpłatnie, ale ponowne użycie tego kodu w publikacji podlega Zasadom Regulaminu. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Chcesz użyć tego skryptu na wykresie?


Check out the indicators we are making at luxalgo: tradingview.com/u/LuxAlgo/
Również na:

Wyłączenie odpowiedzialności