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.
Padrões Gráficos
Linear Regression Trend ChannelThis is my first public release of indicator code and my PSv4.0 version of "Linear Regression Channel", as it is more commonly known. It replicates TV's built-in "Linear Regression" without the distraction of heavy red/blue fill bleeding into other indicators. We can't fill() line.new() at this time in Pine Script anyways. I entitled it Linear Regression Trend Channel, simply because it seems more accurate as a proper description. I nicely packaged this to the size of an ordinary napkin within 20 lines of compact code, simplifying the math to the most efficient script I could devise that fits in your pocket. This is commonly what my dense intricate code looks like behind the veil, and if you are wondering why there is no notes, that's because the notation is in the variable naming. I excluded Pearson correlation because it doesn't seem very useful to me, and it would comprise of additional lines of code I would rather avoid in this public release. Pearson correlation is included in my invite-only advanced version of "Enhanced Linear Regression Trend Channel", where I have taken Linear Regression Channeling to another level of fully featured novel attainability using this original source code.
Features List Includes:
"Period" adjustment
"Deviation(s)" adjustment
"Extend Method" option to extend or not extend the upper, medial, and lower channeling
Showcased in the chart below is my free to use "Enhanced Schaff Trend Cycle Indicator", having a common appeal to TV users frequently. If you do have any questions or comments regarding this indicator, I will consider your inquiries, thoughts, and ideas presented below in the comments section, when time provides it. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Kaufman Adaptive BandsIntroduction
Bands are quite efficient in technical analysis, they can provide support and resistance levels, provide breakouts points, trailing stop loss/take profits positions and can show the current market volatility to the user. Most of the time bands are made from a central tendency estimator like a moving average plus/minus a volatility indicator. Therefore bands can be made out of pretty much everything thus allowing for any kind of flavors.
So i propose a band indicator made from a Kaufman adaptive moving average using an estimate of the standard deviation.
Construction
The Kaufman moving average is an exponential averager using the efficiency ratio as smoothing variable, length control the period of kama and in order to provide more smoothness a power parameter has been introduced, higher values of power will return smoother results.
The volatility indicator is made from a biased estimation of the standard deviation by using the square root of the mean of the square minus the square of the mean method, except that we use kama instead of a mean.
The bands are made by adding/subtracting this volatility indicator with kama.
How To Use
The ability of the indicator to adapt to the current market state is what makes him a great tool for avoiding major exposition during ranging market, therefore the indicator will have a greater motion during trending market, or more simply the bands will move during trending markets while staying "flat" during ranging ones. Therefore the indicator might be more suited to breakouts, even if some cases will return what where turning points, this is particularly true during ranging markets.
Of course the efficiency ratio is not an "unbiased" trend metric indicator, it can consider high volatility markets as trending markets. Its one of his downsides.
High values of power will create smoother bands.
When using a low power parameter use an higher mult. In general using a low power value will make the bands move more freely as well as making them closer to each others.
Conclusion
At least the indicator is really nice to the eyes when using high power values, its ability to adapt to the market is a great addition to other more classical bands indicators, i also introduced a volatility estimator based on kama, some might have used the following estimation : kama(abs(price - kama)) which would have created a slower result. A trailing stop might be made from it if i see request about such addition.
If you are curious here are some more images of the indicator performing on different markets. Thanks for reading !
Combo Strategy 123 Reversal & CCI This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
The Commodity Channel Index (CCI) is best used with markets that display cyclical or
seasonal characteristics, and is formulated to detect the beginning and ending of these
cycles by incorporating a moving average together with a divisor that reflects both possible
and actual trading ranges. The final index measures the deviation from normal, which indicates
major changes in market trend.
To put it simply, the Commodity Channel Index (CCI) value shows how the instrument is trading
relative to its mean (average) price. When the CCI value is high, it means that the prices are
high compared to the average price; when the CCI value is down, it means that the prices are low
compared to the average price. The CCI value usually does not fall outside the -300 to 300 range
and, in fact, is usually in the -100 to 100 range.
WARNING:
- For purpose educate only
- This script to change bars colors.
Combo Strategy 123 Reversal & CCI This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
The Commodity Channel Index (CCI) is best used with markets that display cyclical or
seasonal characteristics, and is formulated to detect the beginning and ending of these
cycles by incorporating a moving average together with a divisor that reflects both possible
and actual trading ranges. The final index measures the deviation from normal, which indicates
major changes in market trend.
To put it simply, the Commodity Channel Index (CCI) value shows how the instrument is trading
relative to its mean (average) price. When the CCI value is high, it means that the prices are
high compared to the average price; when the CCI value is down, it means that the prices are low
compared to the average price. The CCI value usually does not fall outside the -300 to 300 range
and, in fact, is usually in the -100 to 100 range.
WARNING:
- For purpose educate only
- This script to change bars colors.
DEMA ATR Channels - New IndicatorA Double Exponential Moving Average (DEMA) with three sets of channel lines each one Average True Range (ATR) apart, above and below the DEMA.
Similar to my "ATR Channels" indicator, but using a DEMA instead of an EMA for the base. In addition, this indicator also plots a fast DEMA as well as a fill between the two. Fully customizable, you can toggle both DEMAs, the fill, and each set of ATR Channels.
ATR channel idea from Kerry Lovvorn as mentioned in Elder's "New Trading for a Living", page 93: "Kerry Lovvorn likes to plot 3 sets of lines around a moving average: at one, two, and three ATRs above and below an EMA . These can be used for setting up entry points and stops, as well as profit targets."
Volume Weighted Donchian ChannelsDonchian channels weighted with volume, they are now closer to the price and can cross it.
Motion To Attraction ChannelsIntroduction
Channels are used a lot on technical-analysis, however most of the them rely on adding/subtracting a volatility indicator to a central tendency indicator, sometimes the central tendency indicator can even be replaced by pure price. A great channel who does not rely on this kind of architecture is the Donchian channels or the quartiles bands. Here i propose a channel similar to the one made by Richard Donchian with some additional abilities.
The Channels
In my indicator, Motion To Attraction mean that the movement of an object a attract an object b , but we can resume this approach by saying that the longer a trend period is, the smaller the distance between each channels, for example if the price create a new highest then the lowest will move toward this new highest, each time coming closer. The philosophy behind this is that the longer a trend is the more probable it is that she will end.
The code reflect it this way :
here the parameter controlling the channel A (upper)
c = change(b) ? nz(c ) + alpha : change(a) ? 0 : nz(c )
this is traduced by : if channel b move then the parameter c become greater, if channel a move then reset the parameter , the parameter d do the same.
c is used to move the channel A, when c < 1 A is closer to the highest, when c = 1 A is in a central tendency point, when c > 1 A is closer to the lowest.
Slaving the Movement
It is possible to have a better control over the channels, this is done by making c and d always equal or lower than 1. Of course it could be another max value selected by the user.
In order to do that add c1 and d1 as parameter with c1 = c > 1 ? 1 : c , same with d1 but replace c by d.
Its safer to do this but i prefer how the channels act the other way, i will consider implementing this option in the future.
Conclusion
This channel indicator does not rely on past data thanks to recursion. The alpha variable at the start can also be adaptive, this let you make the channels adaptive even if such idea can add non desired results. Low length values can create effects where the lower channel can be greater than the higher one, this can be fixed directly in the code or using the method highlighted in the Slaving the Movement part.
RSI ATR ChannelDraws a channel based on ATR (Average True Range) and RSI. Detects band touches and colors the background appropriately.
Trend Follower With Help of Donchian Channels - TFWHDCThis is a simple Day Trade indicator, but can be used for swing and long term trades.
It is based on Donchian Channels to detect trend and point out resistance or support breakouts using arrows.
The bars ared colored when a breakout occurs. When a resistance breakout occurs the current and the next bars are colored green (default) and when a support breakout occurs the current and the next bars are colored red (default). This way this indicator can show if its an uptrend or a downtrend.
I hope this indicator will be useful for many traders!
Thank you!
Keltner Channel Strategy The Keltner Channel, a classic indicator
of technical analysis developed by Chester Keltner in 1960.
The indicator is a bit like Bollinger Bands and Envelopes.
WARNING:
- This script to change bars colors.
Keltner Channel The Keltner Channel, a classic indicator
of technical analysis developed by Chester Keltner in 1960.
The indicator is a bit like Bollinger Bands and Envelopes.
CryptoShadows V1The first Diagonal Support and Resistance indicator. Best for bitcoin and cryptocurrencies
Periodic ChannelThis indicator try to create a channel by summing a re-scaled and readapted sinusoidal wave form to the price mean.
The length parameter control the speed of the sinusoidal wave form, this parameter is not converted to a sine wave period for allowing a better estimation, higher length's work better but feel free to try shorter periods.
The invert parameter invert the sinusoidal wave.
Each bands represent possible return points, the higher the band the higher the probability.
Inverted sin wave exemple
The performance of the indicator is subjective to the main estimation (blue line), select the parameter that best fit the blue line to the price.
Best ragards
OHLC Daily Resolution BandsShout out to nPE- for the idea.
Bands made with stdev from 10 day OHLC.
Keeps resolution to daily, so you can use bands as daily pivots for day trading.
Upper band 1=yesterday close + 0.5 std(ohlc,10)
Upper band 1=yesterday close + 1 std(ohlc,10)
Mid=yesterday close
Lower band 1=yesterday close - 0.5 std(ohlc,10)
Lower band 2=yesterday close - 1 std(ohlc,1
High Low ChannelBasic high and low channels, allows for two high and two low channels of specified lengths.
Use for channel breakout trades, basic idea is to go long when the longer high channel is broken and close when shorter low channel is broken, vice versa for shorts
Feel free to leave me a tip if you like this script: 1MprT7YEEWaM6bUcpD7eeHM3Ht8n3R5jP1
Dav-o meter (public)I decided to make this formerly invite only script public (you can find the invite only version here
If you are part of the invite only you don't need to change scripts. I will push improvements first on the invite only script but in time it will come to this version as well.
I would love to know your ideas and thoughts on how this indicator can be improved, so feel free to give any feedback.
Remember to give it a thumbs up if you like it.