Extended Recursive Bands StrategyThe original indicator was created by alexgrover .
All credit goes to alexgrover for creating the indicator that this strategy uses.
This strategy was posted because there were multiple requests for it, and no strategy based on this indicator exists yet.
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 Alex's paper "Pierrefeu, Alex (2019): Recursive Bands - A New Indicator For Technical Analysis", the indicator framework has been widely used in his 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".
The Indicator
The indicator displays 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 controls how reactive the bands are, higher values will make the bands cross the price less often.
In order to provide more flexibility for the user alexgrover 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.
Added logic:
We have implemented a logic that checks whether the bands have been following in the same direction for a set amount of bars. This logic must be true before it can enter trades. This is completely new code that was written by us entirely, and it makes a huge difference on strategy performance.
Strategy Long conditions:
1 — Price low is below the the lower band.
2 — The lower band keeps increasing in value until the 'lookback' setting amount of bars is reached.
Strategy Short conditions:
1 — Price high is above the upper band.
2 — The upper band keeps decreasing in value until the 'lookback' setting amount of bars is reached.
Strategy Properties:
We have set a default commission of 0.06% because these are Bybit's fees. The strategy uses an order size of 10% of equity, since drawdown is very low like this. We also use a 10 tick slippage to keep results realistic and account for this. All other settings were left as default apart from initial capital, just to decrease the size of the numbers.
Recursive
Extended Recursive Bands - Maximum Efficiency With Extra OptionsIntroducing 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.
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.
Atr Method (atr)
This method use the average true range as correction factor, notice that lower values of length can still produce wide band.
Standard Deviation Method (stdev)
This method use a biased estimate of the standard deviation as correction factor.
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.
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.
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 !
Smart Envelope - Running Away From The TrendIntroduction
Envelopes indicators consist in displaying one upper and one lower extremity on the price chart. They are most of the time built by adding/subtracting a volatility estimator (rolling stdev, atr, range...etc) to a central tendency estimator (SMA, EMA, LSMA...etc) . Their interpretation is often subject to debate amongst technical analyst, some will use a support and resistance methodology, where price will start a downtrend once it cross the upper extremity, and a down trend once it cross the lower one. Others will prefer a breakout methodology, where price will reach higher highs once it cross the upper extremity, and lower lows when it cross the lower one. Because of price non stationarity its hard to select the best methodology, the support and resistance one will mostly work on ranging markets, while the breakout methodology mostly work on trending ones.
Therefore new methods where proposed, instead of using moving averages with a high lag, faster filters where used, such as the least squares moving average or zero lag exponential moving average, other band indicators where also created using adaptive filters, but improvements remain relatively low. The most difficult task would be to make extremities with the ability to return accurate support and resistances levels, and today i want to provide a new way to construct such extremities by using the recursive bands framework that allow extremely creative and efficient indicators.
The Main Idea
With classical bands indicators, the upper and lower extremity will still be correlated with the main trend, the problem behind such method is that we can't use a support and resistance methodology with trending markets, the fact that reversals exist tells us that our extremities will always be crossed by the main trend, here is an example :
Here the support is correlated with the main trend, in order for it to be accurate we must assume the trend will go on for ever, and will only detect higher lows, this is what we expect with the orange line, but we can see that a severe down trend totally destroy our plan.
In short we need to give some headroom to our extremities, and thus one extremity can't be correlated with the main trend.
The proposed Indicator
We want to minimize the correlation between the extremities, so if the upper extremity rise, the lower one must fall. This allow to give some headroom and allow the user to anticipate larger movements, this is how bands seeking to give support and resistances points should work.
The indicator has a length setting that control the wideness of the extremities, unlike other indicators low values such as 14 can still create really wide bands, take that into account.
length = 5. Lower length values allow for more motion from the extremities, but does not necessarily involve detecting shorter terms support and resistances levels. The factor setting is not that important, but it allow to return extremities with more motion when high, and really wide bands when below 1 and greater than 0.
Central Tendency Estimator
Something fun with the recursive band framework is that the bands are no longer based on the central tendency estimator but its the central tendency estimator who is based on the bands. The central tendency estimator can also provide support and resistances points with the price, like classical moving averages, altho its lack of motion is this time a downside.
Conclusion
Altho the extremities are more accurate than other band indicators, the problem remain the same, larger trend will always break the extremities and continue creating higher/lower highs/lows, at this point our stop loss would certainly be triggered. This is a huge downsides of contrarian strategy, we sure might anticipate reversals earlier, but we are exposed to larger price movements, therefore the risk is extreme.
But the proposed methodology might still prove useful to develop more robust support and resistances levels based on envelopes indicators.
Thanks for reading !
EQma - Adaptive Smoothing Based On Optimal Markets DetectionIntroduction
"You don’t put sunscreen when there is no sun, you don’t use an umbrella when there is no rain, you don’t use a kite when there is no wind, so why would you use a trend following strategy when there is no trend ?"
This is how i start my 4th paper "A New Technical Indicator For Optimal Markets Detection" where i present two new technical indicators. We talked about the first one, running equity, which aim to detect the best moment to enter trades, based on this new metric i made an adaptive moving average.
You can see the full paper here figshare.com
The Indicator
The moving average is based on exponential averaging and use a smoothing variable alpha based on the running equity metric, in order to calculate alpha the running equity is divided by the optimal equity which show the best returns possible for the conditions used. Basically the indicator work as follow :
When the running equity is close to the optimal equity it means that the price need no/little filtering since it does not contain information that need to be filtered, therefore alpha is high, however when the running equity is far from the optimal equity this mean that the price posses malign information that need to be removed.
This is why the indicator will be closer to the price when length is high :
See the full paper for an explanation on how this work.
I added various options for the indicator, one will reduce the lag by squaring alpha, thus giving for length = 14 :
The efficient option will make use of recursion to provide a more efficient indicator :
In green the efficient version, note how this option can allow a better fit with the price.
Conclusion
This is an indicator but at its core its rather a framework, if you have read the paper you'll see that the conditions are just 1 and -1 that changes with time, basically its like making a strategy with :
Condition = if buy then 1 else if sell then -1 else Precedent value of condition.
So those two indicators allow to give useful and usable information about your strategy. I hope it can be of use for anyone here, if so don't hesitate to send me what you made using the proposed indicator (and with all my indicators in general). If you are writing a paper and you think this indicator could fit in your work then let me know so i can be aware of it :)
Thanks for reading !
Acknowledgement
My papers are quite ridiculous but they still manage to get some views, some researchers don't even reach those number in so little time which is quite unfortunate but also really motivating for me, so thanks to those who take time to read them and give me some feedback :)
Modular Filter - Spot Trends And Smooth PriceIntroduction
This indicator can have a wide variety of usages, and since it is based on exponential averaging then the whole indicator can be made adaptive, thus ending up with a really promising tool. This indicator who can both smooth price and act as a trailing stop depending on user preferences, i tried to make it as reactive, stable and efficient as possible in order to both smooth and spot trends, lets view it more in depth.
The Indicator
line 8 and 9 create two bands, one upper and one lower, then based on certain conditions the indicator will only return a certain band or an average of both with different weights, this weight is controlled by the beta parameter, values of 1 will return a simple filter while values of 0 will return a classical trailing stop.
beta = 0
The indicator can use output values as input, thus using smoother values as input, in order to do so just check "Feedback", this help the overall output to be smoother as well as giving more long terms signals
The amount of feedback is controlled by the feedback weighting parameter, lower values will weight more the output values thus creating smoother results.
Feedback weighting of 0.2
Using beta = 0 thus having the indicator act as a trailing stop while having the feedback option activated return more long terms signals. Notes that the colors are based on the initial conditions of the indicator.
Conclusion
You can replace length and change alpha for any smoothing variable such as the efficiency ratio or anything with scale (1,0), same goes for beta and the feedback weighting parameter, this is why the indicator is "Modular" in addition of providing different usages. This indicator can look like cluster filters (smooth price monarch, forexguru) , filters with the ability to follow the price quite fine while being stables. I really hope you find an use to it.
Thanks for reading !
Volume Adaptive BandsIntroduction
I have been asked by @Coppermine and @Verbena to make bands that use volume to provide adaptive results. My first approach was to use exponential averaging, in order to do so i needed to quantify volume movement using rescaling with the objective to make the bands go away from each others when there is low volume, this approach is efficient and can work on any time frame, however i decided at the end to use another method which rely on recursive weighting, cleaner but more parametric. Those bands aim to highlight great breakouts point to go with the trend.
The Indicator
length control the period of the moving averages used in the script, however low length's don't necessarily provide indications for shorter terms breakouts as shown here :
As i said the bands are close to each others when there is high volume and away when there is low volumes.
Low volume period, bands will avoid to cross price
High volume, bands will be close to generate signals.
Correction Factor
Higher time frames will lower the distance between each band, this is because volume is higher during higher time frames, remember that the indicator bands are close to each others when volume is high.
1h chart eurusd.
This is why i added a correction factor, this factor can help you control the distance between each bands, when the correction factor is greater than 1 the bands will be closer to each others, this is useful for low time frames where the average volume is lower. When the time frame is high, use values between 0 and 1 to increase distance between each bands.
Correction factor = 0.2
Conclusion
I presented a new adaptive band indicator that adapt to trading volume by using recursive weighting, volume can be replaced by other indicators but you can have results going nuts, at the end its about experimentation. I hope you will find an use to it, thanks to @Coppermine and @Verbena for the request :)
Thanks for reading !
Recursive StochasticThe Self Referencing Stochastic Oscillator
The stochastic oscillator bring values in range of (0,100). This process is called Feature scaling or Unity-Based Normalization
When a function use recursion you can highlights cycles or create smoother results depending on various factors, this is the goal of a recursive stochastic.
For example : k = s(alpha*st+(1-alpha)*nz(k )) where st is the target source.
Using inputs with different scale level can modify the result of the indicator depending on which instrument it is applied, therefore the input must be normalized, here the price is first passed through a stochastic, then this result is used for the recursion.
In order to control the level of the recursion, weights are distributed using the alpha parameter. This parameter is in a range of (0,1), if alpha = 1, then the indicator act as a normal stochastic oscillator, if alpha = 0, then the indicator return na since the initial value for k = 0. The smaller the alpha parameter, the lower the correlation between the price and the indicator, but the indicator will look more periodic.
Comparison
Recursive Stochastic oscillator with alpha = 0.1 and bellow a classic oscillator (alpha = 1)
The use of recursion can both smooth the result and make it more reactive as well.
Filter As Source
It is possible to stabilize the indicator and make it less affected by outliers using a filter as input.
Lower alpha can be used in order to recover some reactivity, this will also lead to more periodic results (which are not inevitably correlated with price)
Hope you enjoy
For any questions/demands feel free to pm me, i would be happy to help you
Recursive Median Oscillator & Fisher Transforms RibbonThis is a composite indicator made up of:
- modifided (rescaled) version of evergets version of recursive median oscillator.
- 1996anoojpatels Futur modification of Ehlers Fisher Transform Ribbons Indicator
I think Ehlers attempts to minimise latency in indicators are extremely valuable and some of my most use trading tools. Thanks to all the authors whose iterations keep moving these indicators toward perfection. Here is my contribution.
Recursive Median FilterRecursive Median Filter indicator script.
This indicator was originally developed by John F. Ehlers (Stocks & Commodities V. 36:03 (8–11): Recursive Median Filters).
Recursive Median OscillatorRecursive Median Oscillator indicator script.
This indicator was originally developed by John F. Ehlers (Stocks & Commodities V. 36:03 (8–11): Recursive Median Filters).
Recursive Moving Trend AverageRecursive Moving Trend Average indicator script.
This indicator was originally developed by Dennis Meyers (Stocks & Commodities V.16:12, The Yen, Recursed).
Recursive Moving Trend Average Taken from an article "The Yen Recused" in the December 1998 issue of TASC,
written by Dennis Meyers. He describes the Recursive MA in mathematical terms
as "recursive polynomial fit, a technique that uses a small number of past values
of the estimated price and today's price to predict tomorrows price."