The Turtle Trading ChannelTurtle Rules:
To trade exactly like the turtles did, you need to set up two indicators representing the main and the failsafe system.
Set up the main indicator with TradePeriod = 20 and StopPeriod = 10 (A.k.a S1)
Set up the failsafe indicator with TradePeriod = 55 and StopPeriod = 20 (A.k.a S2)
The entry strategy using S1 is as follows
Buy 20-day breakouts using S1 only if last signaled trade was a loss.
Sell 20-day breakouts using S1 only if last signaled trade was a loss.
If last signaled trade by S1 was a win, you shouldn't trade -Irregardless of the direction or if you traded last signal it or not-
The entry strategy using S2 is as follows:
Buy 55-day breakouts only if you ignored last S1 signal and the market is rallying without you
Sell 55-day breakouts only if you ignored last S1 signal and the market is pluging without you
The turtles had a progressive position sizing approach that boosted their winnings. Once a trading decision has been made you should...
Enter the market with 2% risk. Place stop-loss 2ATR from the opening price.
If the position moves in your favor 1/2ATR, enter the market again with 2% risk and trail all stop-losses 2ATR from current price.
If the position moves in your favor 1/2ATR, enter the market again with 2% risk and trail all stop-losses 2ATR from current price.
If the position moves in your favor 1/2ATR, enter the market again with 2% risk and trail all stop-losses 2ATR from current price.
Stop adding to positions when 4 positions have been taken. (*** And see money management rule below)
The exit strategy is carried out using the line with the shortest period of the indicator:
Exit longs taken using S1 when price action closes below a 10-day low
Exit shorts taken using S1 when price action closes above a 10-day high
Exit longs taken using S2 when price action closes below a 20-day low
Exit shorts taken using S2 when price action closes avove a 20-day high
The turtles had very strict money management too. Initial position risk was 2%, but it decreased according to the current drawdown.
If the account had a 10% drawdown, the risk for each trade should decrease a 20%
If the account had a 20% drawdown, the risk for each trade should decrease a 40%.
If the account had a 30% drawdown, the risk for each trade should decrease a 60%.
So, if the account had a N% drawdown, the risk for each trade should decrease N*2%.
Spanish Traslation :
Reglas de las tortugas:
Para tradear exactamente como lo hacían las tortugas, debe configurar dos indicadores que representen el sistema principal y el de seguridad .
Configure el indicador principal con TradePeriod = 20 y StopPeriod = 10 (Aka S1 )
Configure el indicador de seguridad con TradePeriod = 55 y StopPeriod = 20 usando un color diferente. (También conocido como S2 )
La estrategia de entrada usando S1 es la siguiente
Compre rupturas de 20 días usando S1 solo si la última operación señalada fue una pérdida.
Venda rupturas de 20 días usando S1 solo si la última operación señalada fue una pérdida.
Si la última operación señalada por S1 fue una victoria, no debe operar, independientemente de la dirección o si la última operación la realizó o no.
La estrategia de entrada con S2 es la siguiente:
Compre rupturas de 55 días solo si ignoró la última señal S1 y el mercado se está recuperando sin usted
Venda rupturas de 55 días solo si ignoró la última señal S1 y el mercado se está disparando sin usted
Las tortugas tenían un enfoque de tamaño de posición progresivo que aumentó sus ganancias. Una vez que se haya tomado una decisión comercial, debe ...
Ingresar al mercado con un 2% de riesgo. Coloque el stop-loss 2ATR desde el precio de apertura.
Si la posición se mueve a su favor 1 / 2ATR, ingrese al mercado nuevamente con un 2% de riesgo y arrastre todos los stop-loss 2ATR del precio actual.
Si la posición se mueve a su favor 1 / 2ATR, ingrese al mercado nuevamente con un 2% de riesgo y arrastre todos los stop-loss 2ATR del precio actual.
Si la posición se mueve a su favor 1 / 2ATR, ingrese al mercado nuevamente con un 2% de riesgo y arrastre todos los stop-loss 2ATR del precio actual.
Deje de agregar posiciones cuando se hayan tomado 4 posiciones. (*** Y vea la regla de administración de dinero a continuación)
La estrategia de salida se realiza utilizando la línea de menor periodo del indicador:
Salga de largos tomados usando S1 cuando la acción del precio cierra por debajo de un mínimo de 10 días
Salga de los cortos tomados con S1 cuando la acción del precio cierre por encima de un máximo de 10 días
Salga de largos tomados usando S2 cuando la acción del precio cierra por debajo de un mínimo de 20 días
Salga de los cortos tomados con S2 cuando la acción del precio se cierre evite un máximo de 20 días
Las tortugas también tenían una administración de dinero muy estricta . El riesgo de la posición inicial fue del 2%, pero disminuyó de acuerdo con la reducción actual.
Si la cuenta tiene una reducción del 10%, el riesgo de cada operación debería disminuir un 20%.
Si la cuenta tiene una reducción del 20%, el riesgo de cada operación debería disminuir un 40%.
Si la cuenta tiene una reducción del 30%, el riesgo de cada operación debería disminuir un 60%.
Entonces, si la cuenta tiene una reducción del N%, el riesgo de cada operación debería disminuir N * 2%.
圖表形態
Fluffykats's Double Bottom indicator with alert v1This is a double bottom indicator with an alert that has many settings to customize your double bottom .
From Wikipedia "A double bottom is the end formation in a declining market. The pattern is formed by two price minima separated by local peak defining the neck line. The formation is completed and confirmed when the price rises above the neck line, indicating that further price rise is imminent or highly likely."
The following can be customized:
The left and right bar strengths for both the Right Top ( RT ) and Left Top ( LT ). For an explanation on RT / LT bar strength see (pivothigh) tradingview pine script API notes.
The price variance in % between RT / LT
The minimum and maximum allowable separation between RT / LT
Ability to toggle visibility of prices
PM us to obtain access
Best regards.
Channel Cross StrategyTrend Following using Channel based Script. Long and Short Entry based on Custom filter to avoid False Signal.
Works best for BankNifty and Nifty and few Indian Stocks.
Untick Exponential gives better Result.
Modified Donchian ChannelRelease Note:
This indicator setup highly inspired by Donchian Channel and Hull Moving Average. Big thanks to both Richard Donchian and Alan Hull.
Back test and live test it and come to conclusion of how to use this indicator for live trading.
200 HMA:
200 Hull Moving Average plays major role in deciding the right trades using Donchian Channel. As part of this setup,
If price is below 200 HMA, then the Donchian Channel is highlighted in Red color
If price is above 200 HMA, then the Donchian Channel is highlighted in Green color
Donchian Channel:
Default 20 period is used for the Donchian channel. However, the color highlight as per 200 HMA position. Also, the middle basis color changes to Green and Red based on candle close of above or below.
Additionally, 5 period Donchian basis is used as tight stop loss. This can be used wisely or optionally based on trade decisions
Disclaimer:
//Idea of publishing this script is to identify the strength of the instrument using multiple confirmation.
//Using this indicator, changing inputs, and trading decisions are up to the users/traders.
//Courtesy: Thanks to Richard Donchian and Alan Hull as this indicator/script inspired by Donchian Channels and Hull Moving Average
EMA Keltner Channel 1D100/200 EMAs, along with Keltner Bands based off them. Colors correspond to actions you should be ready to take in the area. Use to set macro mindset.
Uses the security function to display only the 1D values.
Red= Bad
Orange = Not as Bad, but still Bad.
Yellow = Warning, might also be Bad.
Purple = Dip a toe in.
Blue = Give it a shot but have a little caution.
Green = It's second mortgage time.
Emke ChannelThis is a slightly modified Keltner Channel with 100/200 EMAs.
Based on mean reversion theory that price will be more and more difficult to maintain it's direction the farther it gets from the EMAs.
It uses the security feature to only show the 1D channel.
Double Top Double Bottom [MS]Automatic Double Top and Double Bottom pattern scanner for any time frame, any asset.
Simple to use, just add to your chart, and set the size (in the settings) for the patterns you want to find.
• Green patterns are bullish
• Red patterns are bearish
• Alerts are available for when new patterns are displayed
• When a pattern completes (at the neckline), it will change from dotted lines to solid lines.
To scan for multiple sizes of patterns, add the script to your chart multiple times.
Use the link below or PM us to obtain access to this indicator.
Optimized Linear Regression ChannelReturn a linear regression channel with a window size within the range (min, max) such that the R-squared is maximized, this allows a better estimate of an underlying linear trend, a better detection of significant historical supports and resistance points, and avoid finding a good window size manually.
Settings
Min : Minimum window size value
Max : Maximum window size value
Mult : Multiplicative factor for the rmse, control the channel width.
Src : Source input of the indicator
Details
The indicator displays the specific window size that maximizes the R-squared at the bottom of the lower channel.
When optimizing we want to find parameters such that they maximize or minimize a certain function, here the r-squared. The R-squared is given by 1 minus the ratio between the sum of squares (SSE) of the linear regression and the sum of squares of the mean. We know that the mean will always produce an SSE greater or equal to the one of the linear regression, so the R-squared will always be in a (0,1) range. In the case our data has a linear trend, the linear regression will have a better fit, thus having a lower SSE than the SSE of the mean, has such the ratio between the linear regression SSE and the mean SSE will be low, 1 minus this ratio will return a greater result. A lower R-squared will tell you that your linear regression produces a fit similar to the one produced by the mean. The R-squared is also given by the square of the correlation coefficient between the dependent and independent variables.
In pinescript optimization can be done by running a function inside a loop, we run the function for each setting and keep the one that produces the maximum or minimum result, however, it is not possible to do that with most built-in functions, including the function of interest, correlation , as such we must recreate a rolling correlation function that can be used inside loops, such functions are generally loops-free, this means that they are not computed using a loop in the first place, fortunately, the rolling correlation function is simply based on moving averages and standard deviations, both can be computed without using a loop by using cumulative sums, this is what is done in the code.
Note that because the R-squared is based on the SSE of the linear regression, maximizing the R-squared also minimizes the linear regression SSE, another thing that is minimized is the horizontality of the fit.
In the example above we have a total window size of 27, the script will try to find the setting that maximizes the R-squared, we must avoid every data points before the volatile bearish candle, using any of these data points will produce a poor fit, we see that the script avoid it, thus running as expected. Another interesting thing is that the best R-squared is not always associated to the lowest window size.
Note that optimization does not fix core problems in a model, with the linear regression we assume that our data set posses a linear trend, if it's not the case, then no matter how many settings you use you will still have a model that is not adapted to your data.
TF Segmented Linear RegressionFit a line at successive intervals, where the interval period is determined by a user-selected time frame, this allows the user to have an estimate of the intrinsic trend within various intervals.
Settings
Timeframe : Determine the period of the interval, if the timeframe is weekly then a new line will be fit at the start each weeks, by default "Daily"
Mult : Multiplication factor for the RMSE, determine the distance between the upper and lower extremities
Src : Input data for the indicator
Plot Extremities : Logical value, if true then the extremities of the channel are plotted, if false only the midline is plotted, true by default.
Usage
The timeframe setting should be higher than the current chart timeframe, note however that too large values of timeframe might return an error. Since the maximum number of lines that can be plotted is 54, using the extremities will only return 18 channels.
The indicator can be compared to the "regression trend" drawing tool
Main tf = 5 min with the indicator using a daily timeframe, the filled area is produced by the regression trend drawing tool using the same interval as the indicator, and coincide with it.
Main tf = 15 min with the indicator using a weekly timeframe, wider channel indicate that the values tend to be farther away from the fitted line.
A line with a significant slope indicates a strong trend, in that case, the width of the channel is determined by the amplitude of the retracements in the trend, with a narrower channel indicating a cleaner trend.
When the fitted line has a low slope value and the channel is wide, it means that there were two or more variations of opposite directions with large amplitudes within the interval, this also indicates that a linear model is not appropriate.
A slope approximately equal to 0 with a low channel width indicates a trendless market with cyclical variations of low amplitude in it.
Refrences
Determining the starting and ending points of the fitted line was done using a linear combination between the wma and sma
The wma and sma functions both use a series as period by making use of the Wma and Sum functions in the following script
NSDT ES Midline Zones**DESIGNED FOR ES/MES** This script provides an easy visualization of potential reversion zones to take trades back to the intraday midline. A common use would be to enter a position once price reached the outer yellow zones and retreats to either the red zone (for a short toward the midline) or a green zone (for a long back to the midline).
NSDT NQ Midline Zones**DESIGNED FOR NQ/MNQ** This script provides an easy visualization of potential reversion zones to take trades back to the intraday midline. A common use would be to enter a position once price reached the outer yellow zones and retreats to either the red zone (for a short toward the midline) or a green zone (for a long back to the midline).
Fluffykat's Double Top indicator with alert v1This is a free double top indicator with an alert that has many settings to customize your double top.
From Wikipedia "The double top is a frequent price formation at the end of a bull market. It appears as two consecutive peaks of approximately the same price on a price-versus-time chart of a market. The two peaks are separated by a minimum in price, a valley. The price level of this minimum is called the neck line of the formation. The formation is completed and confirmed when the price falls below the neck line, indicating that further price decline is imminent or highly likely."
The following can be customized:
The left and right bar strengths for both the Right Top (RT) and Left Top (LT). For an explanation on RT/LT bar strength see (pivothigh) tradingview pine script API notes.
The price variance in % between RT / LT
The minimum and maximum allowable separation between RT/LT
Ability to toggle visibility of prices
Best regards.
Cyatophilum Double Top & Bottom [ALERTSETUP]Private Indicator
Version Alpha
The indicator is subject to changes.
This indicator's goal is to help automatically find double top and double bottom patterns.
Its core algorithm uses purely price action and does not use any kind of overbought/oversold oscilator.
To be validated, a double top/bottom must be preceded by a simple top/bottom.
Parallel Channels
To be validated, a double top/bottom must be inside the top/bottom parallel channel. Channels will expire after some time. A channel's range is automatically calculated when changing timeframe or symbol. Channels can be used to trade breakouts after a double top/bottom happened.
Alerts
This indicator allows to create automated alerts in order to receive signals for an event. The available alerts are:
Double Bottom
Double Top
Simple Bottom
Simple Top
Send me a message if you would like to help me test the indicator.
Bollinger Channels / EMA and SMAThis is written as a system to replace the BB strategy.
I think it will work well.
It looks pretty stylish.
Description / Usage:
Adjust the length and multiplier based on your location with Bollinger Bands.
The multiplier of 1 provides you with a basic channel with high and low-source EMA (or SMA).
And with the 8-day exponential moving average, you can observe short entries and exits.
I wish good luck to the friends who will use it.
You can support and track new indicators.
Bu, BB stratejisinin yerini alacak bir sistem olarak yazılmıştır.
Oldukça şık görünüyor.
Kullanım
Bollinger Bantları ile bulunduğunuz yere göre uzunluk ve çarpanı ayarlayın.
1 çarpanı size yüksek ve düşük kaynaklı EMA (veya SMA) içeren temel bir kanal sağlar.
Ve 8 günlük üstel hareketli ortalama ile kısa giriş ve çıkışları gözlemleyebilirsiniz.
Kullanacak arkadaşlara bol kazançlar diliyorum.
Yeni indikatör için destek olabilir ve takip edebilirsiniz.
Donchain channel improvedThis channel is based on donchain with added trend immediate support and resistance. I hope you all like it.
Efficient Trend Step ChannelIntroduction
The efficient trend-step indicator is a trend indicator that make use of the efficiency ratio in order to adapt to the market trend strength, this indicator originally aimed to remain static during ranging states while fitting the price only when large variations occur. The trend step indicator family unlike most moving averages has a boxy appearance and could therefore not be classified as smooth, this makes it an indicator relatively uninteresting to use as input for other non-trending indicators such as oscillators.
Today a channel indicator making use of the efficient trend-step is proposed, the indicator has an upper and a lower extremity who can be used for breakout or support and resistance methodologies, however we will see that the indicator is sometimes able to return accurate support and resistance levels.
The Indicator
The indicator has the same settings has the efficient trend step indicator, length control the period of the efficiency ratio, fast control the period of the rolling standard deviation used for trending states, slow control the period of the rolling standard deviation used for ranging states, fast should be lower than slow , if both are equal then the indicator is equal to the classical trend step indicator and length does no longer affect the indicator output. Lower values of fast/slow will make the indicator more reactive to small variations thus changing direction more often.
The color changes you can see on the indicator are changed depending on the prior direction took by the indicator output, if the indicator where higher than its precedent value, then the color will be blue until the indicator is lower than its precedent value. Those colors help you have an estimate of the current trend direction.
Channel Calculation And Role
The extremities made from the efficient trend step allow for more advanced trading rules, they can act as stop/target level and can also give a rough estimate of the current market volatility, with wider extremities indicating a more volatile market.
The extremities are made directly from the dev element used by the efficient trend-step, the upper extremity is made by summing the efficient trend step with the value of dev when the efficient trend step change, the lower extremity is made the same way but the value is subtracted instead.
Is it a weird choice ? It sure is strange to see such approach, the absolute rolling average error between the price and the efficient trend step could have been a logical measure but using dev instead is more efficient and also allow for a more adaptive approach which can benefit the support and resistance methodology, the last reason is because i didn't wanted to "denature" the trend-step signature of the indicator.
The figure above represent the measurement used for making the extremities (in green).
Since the previously described measure change only when the efficient trend step change, we can conclude that such measure is representative of a relatively large variation, since the efficient trend step aim to only change when a large variations appear.
We can see that the upper extremity acted as an accurate resistance in this upper variation of AMD,
Here as well, however like other bands indicators it is safer to take into account the current trend direction, a strong uptrend will have less difficulties crossing the upper extremity, therefore it might be better to rely on the support (lower extremity) on an up-trending market (indicator in blue), and on the resistance (upper extremity) on an down-trending market (indicator in orange).
The figure above show support and resistances signals, a cross represent a false signal, while green arrows represent correct ones with their respective direction.
Conclusion
The presented indicator add more possibilities to the interpretation of the efficient trend step, the extremities can act as stop/target level, however this use has to be controlled, and the level should be in accordance to your risk/reward ratio.
Showcasing another trend-step indicator was a real pleasure. Thanks for reading :)
TradewithPuneet: Pro-PatternsThe Pro-Patterns strategy is designed to trade classic chart patterns. At present, it identifies the Ascending Triangle patterns and Weekly Inside Bars patterns and takes Long or Short entries, as the case may be.
Ascending Triangle patterns:
- The strategy identifies ascending triangle patterns ranging from 40 to 120 days.
- BUY signals are generated on the breakout of the horizontal resistance line. No SHORT signal is generated on the breakdown of the rising trend line.
- The importance is given to higher lows, instead of attempting to make a perfectly straight rising trend line. Hence, the drawing of the rising trend line is skipped.
- The strategy gives BUY signals on continuation as well as reversal patterns.
- Users can choose exit rules either on the breakdown of a certain number of days or based on ATR.
- The Ascending triangle patterns can be seen on Daily timeframes only.
Weekly Inside Bars
- The strategy identifies inside bars on weekly charts with three candles. This means, that Weekly Inside Bars pattern is said to be formed when the current week's candle is inside the previous week and the previous week's candle is inside the week prior to it.
- A BUY or SHORT signal is generated next week on breakout or breakdown of high or low of third week’s candle.
- The importance is given to a decrease in volume on second & third weeks’ candles.
- The strategy gives BUY or SHORT signals on continuation as well as reversal patterns. However, users can choose to see trading signals on continuation patterns only.
- Users can choose exit rule on breakdown or breakout of a certain number of weeks in case of BUY & SHORT signals respectively.
- The Weekly Inside Bars patterns can be seen on Weekly timeframes only.
The strategy guides you the price level at which to BUY / SHORT and EXIT. It is intended for short to medium-term traders. It is important for the security to close beyond the trigger point for the signal to remain in force.
Double EnvelopeDouble Envelope is an indicator that is created using two pairs of moving averages that determine the upper and lower levels of the price range. Envelopes are commonly used to help traders and investors identify extreme overbought and oversold conditions as well as trading ranges.
We advise you to use the indicator on the daily timeframe, it is there that the resolutions that are set by default work best.
[RD] Easy Fibonacci Channels==================================================================
October 21 2019 - Easy Fibonacci Channels - by RootDuk
==================================================================
Easy adaptable fibonacci channels. By changing the levels you can adapt
the lines as needed. There's also global params to use for horizontal and
vertical scaling.
===================================================================
Notes
===================================================================
None so far
===================================================================
Updates
===================================================================
Non so far
Price-Curve ChannelIntroduction
Although many will use lines in order to make support and resistances, others might use curves, this is logical since trends are not always linear. Therefore it was also important to take this into consideration, and when i published the price-line channel indicator, i already started a curved version of it. Therefore i propose this new indicator based on the recursive bands framework that allow to return curved support and resistances. The benefits of this indicator are : a totally stable approach, user friendly, and extremities able to converge faster toward the price.
The Indicator
The indicator is way faster than the price-line channel one, this is due to the fast convergence toward the price of the extremities. Length control the reactivity of the indicator, while mult is more related to the rate of convergence, values of mult lower than 1 will make the curve converge slower,
mult = .5
Higher values of mult will make the extremities converge faster toward the price.
mult = 2
Unlike the price-line channel indicator this one is directly "readjusted", this is due to the fact that the extremities are no longer linear, of course a "perfectly" curved version could come in an update, but for the moment it wasn't really a necessity.
Comparison With Price-Line
The fact that the extremities converge faster toward the price allow to possibly capture more tops/bottoms/retracements. However the extremities of both indicator have the same behavior regarding their accuracy, for example the upper extremity have a higher chance to detect a retracement when on a downtrend, while the lower extremity have higher chance to detect a retracement while on a up-trend.
On The Indicator Construction
The recursive bands framework is the core of the indicator, it is important to use it. The curved effect is given by multiplying the correction factor by the barssince function, therefore the correction factor is no longer constant which in return allow for a non linear output.
The size is divided by the square of length in order to keep a certain logic between the output and the length period.
Conclusion
The recursive bands framework prove again to be quite interesting, lot of indicators can be made using it, i only posted a fraction of what can be done with it, which make the recursive bands indicator one of the best indicators i ever made in my opinion.
The proposed indicator is stable, and don't require nightmarish manipulations (unlike the linear channels indicator), its ability to detect possible support and resistances points, although subjective, remain a feature of the indicator. The use of recursion make the indicator efficient. I hope the indicator find some use in the community.
Thanks for reading !
Linear version.
Note
Respect the house rules, always request permission before publishing open source code. This is an original work, requesting permission is the least you can do.
I apologize for any grammatical/orthographic error in this post.
Price-Line Channel - A Friendly Support And Resistance IndicatorIntroduction
Lines are the most widely used figures in technical analysis, this is due to the linear trends that some securities posses (daily log SP500 for example), support and resistances are also responsible for the uses of lines, basically linear support and resistances are made with the assumption that the line connecting two local maximas or minimas will help the user detect a new local maxima or minima when the price will cross the line.
Technical indicators attempting to output lines have always been a concern in technical analysis, the mostly know certainly being the linear regression, however any linear models would fit in this category. In general those indicators always reevaluate their outputs values (repainting), others non repainting indicators returning lines are sometimes to impractical to set-up. This is what has encouraged me to make a simpler indicator based on the framework used in the recursive bands indicator that i published.
The proposed indicator aim to be extremely flexible and easy to use while returning linear support and resistances, an option that allow readjustment is also introduced, thus allowing for a "smarter" indicator.
The Indicator
The indicator return two extremities, the upper one aim to detect resistance points while the lower one aim to detect support points. The length setting control the steepness of the line, with higher values of length involving a lower slope, this make the indicator less reactive and interact with the price less often.
The name "price-line" comes from the fact that the channel is dependent on its own interaction with the price, therefore a breakout methodology can also be used, where price is up-trending when crossing with the upper extremity and down trending when crossing with the lower one.
Readjusted Option
The line steepness can be readjusted based on the market volatility, it make more sense for the line to be more steep when the market is more volatile, thus making it converge faster toward the price, this of course is done at the cost of some linearity. This is achieved by checking the "readjustment" option. The effects can be shown on BTCUSD, below the indicator without the readjusted option :
when the "readjustment" option is checked we have the following results :
The volatile down movement on BTCUSd make the upper extremity converge faster toward the price, this option can be great for volatile markets.
Conclusion
The recursive bands indicator prove to be an excellent framework that allow for the creation of lots of indicators, the proposed indicator is extremely efficient and provide an easy solution for returning linear support and resistances without much drawbacks, the readjusted option allow the indicator to adapt to the market volatility at the cost of linearity.
The performance of the indicator is relative to the motion of the price, however the indicator show signs of returning accurate support and resistances points. I hope the indicator find its use in the community.
Thanks for reading !
Note
Respect the house rules, always request permission before publishing open source code. This is an original work, requesting permission is the least you can do.
G-Channels - Efficient Calculation Of Upper/Lower ExtremitiesIntroduction
Channels indicators are widely used in technical analysis, they provide lot of information. In general, technical indicators giving upper/lower extremities are calculated by adding/subtracting a volatility component to a central tendency estimator. This is the case with Bollinger bands, using the rolling standard deviation as volatility estimator and the simple moving average as central tendency estimator, or the Keltner channels using the exponential moving average and the average true range.
Lots and lots and lots (i can go on) of those indicators have been made, they only really need a central tendency estimator, which can be obtained from pretty much any filter, however i find interesting to focus on the efficiency of those indicators, therefore i propose a super efficient channel indicator using recursion. The average resulting from the upper/lower extremity of the indicator provide a new efficient filter similar to the average highest/lowest.
The calculation - How Does It Works
Efficiency is often associated to recursion, this would allow us to use past output values as input, so how does the indicator is calculated? Lets look at the upper band calculation :
a := max(src,nz(a(1))) - nz(a(1) - b(1))/length
src is the closing price, a is upper extremity, b is the lower one. Here we only need 3 values, the previous values of a and b and the closing price. Basically a := max(src,nz(a(1))) mean :
if the closing price is greater than the precedent value of a then output the closing price, else output the precedent value of a
therefore a will never be inferior to its precedent value, this is useful for getting the maximum price value in our dataset however its not useful to make an upper band, therefore we subtract this to a correction factor defined as the difference between a and b , this force the upper band to have lower values thus acting like a band without loosing its "upper" property, a similar process is done with the lower band.
Of course we could only use 2 values for making the indicator, thus ending with :
a := max(src,nz(a(1))) - nz(abs(close - a(1))/length
In fact this implementation is the same as the one proposed in my paper "Recursive Bands - A New Indicator For Technical Analysis", its also what i used for making the indicator "Adaptive Trailing Stop", this would be more efficient but i used the difference between the upper and lower extremities for a reason.
The Central tendency Estimator
This is the reason why i didn't implemented a more efficient version. Basically this central tendency estimator is just the average between the upper and lower extremities, it behave like the average of the highest/lowest over length period, its central plot in the Donchian channel indicator. Below is a comparison of both with length = 100 :
But why is our average so "boxy"? The extremities are not boxy, so why the average is sometimes equal to its previous value? Explain!
Its super easy to understand, imagine two lines, if their absolute change is the same and they follow an opposite direction, then their average is constant.
the average of the green and red line is the orange line. If both lines follow the same direction then their average will also follow this direction.
When both extremities follow the same direction, the average will also do the same, when both follow an opposite direction then the average will be equal to its precedent value, this is also due to the fact that both extremities are based on the same correction factor (a-b) , else the average wouldn't act that way, now you understand why i made this choice.
Conclusion
I proposed an efficient implementation of a channel indicator that provide an interesting central tendency estimator. This simple implementation would allow for tons of interesting concepts, some of my indicators use a similar approach and allow for great outputs, you'll see them soon enough. I hope this indicator find its use in the community, remember to ask before using this indicator in a script you want to publish.
Thanks for reading !
If you want to discuss about anime stuff send me a pm but don't do it in the commend section.