As a COG the center line of a Donchian Channel is often used. I.m.o. a COG should be a zone, in this channel I use the gray zone of my Donchian Fibonacci Channel, The ‘normal’ range is a multiple of Average True Range, as used in a Keltner Channel. Combining the two can give a cumbersome result, as one can see in my Keltner Fibonacci Channel. In this KeltCOG channel I solved this by not using all Fibonacci levels and by making the Keltner lines strictly parallel to the nearest COG line. To do this, I use the fact that the COG lines have horizontal stretches, there I make the Keltner lines horizontal too. Only where the COG lines change value, the Keltner lines are recalculated. This way the channel gets a very regular shape with three clear zones.
Interpretation of a chart by using the KeltCOG channel.
Overbought: If the candles go higher then the blue zone, the market is hyper enthusiast, creating an overbought situation. This is often followed by a reversion to the COG.
Uptrend: If the candles form in the blue zone, the market is enthusiast and willing to pay more.
Hopeful: If the candles form in or near the upper uncolored zone, the market is hopeful and is thinking about paying more. Sometimes prices go a little up.
Content: If the candles form in the gray zone, which represents COG, the market is happy with the current prices, so these move sideways
Disappointed: If the candles form in or near the lower uncolored zone, the market is disappointed and contemplates paying less, sometimes prices go a little down.
Downtrend: If the candles form in red zone, the market doesn’t like the instrument at all, rejects the current price and is only prepared to pay less.
Oversold: If the candles form below the red zone, the market overdoes its disgust, creating an oversold situation, often followed by a reversion to the COG.
For my own use I set the look back to 14 for weekly charts, to 21 for dailies, to 28 for 3hourlies and to 35 to hourly charts.
For finer intraday charts I guess the user will like even longer look back periods, but that is to his, hers or whatevers discretion.
1. The script chooses a lookback period that matches the timeframe. This feature can be switched off in the inputs, allowing the user to enter the lookback manually
Remarks on the connection between lookback and timeframe: The lookback should i.m.o. be equal to the ‘look forward’. Examples: If you choose a minute chart, you probably are a day trader and you wish to estimate where the quotes might go in the next hour. Then you should choose a lookback near 60, because the cannel will then provide the range and the COG generated by the previous hour and show the relative place of the current price in this range. If you choose an hourly chart, your horizon is probably a few days, so 35 is a proper choise, If you choose a monthly chart, you might want to estimate possibilities for the coming half year, so 7 is a proper value for this argument. The scrips chooses multiples of seven due to some superstition of mine. The script values reveal my personal subjective opinion, so the user can choose other arguments.
2. The script chooses a width that matches the lookback period. This feature can be switched off in the inputs, allowing the user to enter the width manually.
Remarks on the desirable width of the channel: The ‘landscape’ of the channel is meant to encompass most candles with some of those touching the border, then one can reasonably claim that the channel shows the ‘natural range’, providing an argument to call and ‘overbought’ or ‘oversold’ if candles move outside. Interdependency with lookback is caused by the fact that both the COG and the natural range are relatively wider when the lookback is further. However because this is not a linear connection, it took me a few hours to create a non linear formula that seems to works fine.
3. A feedback label is created to show the values that are used for lookback and width and whether these originate from the script or the user. This label can be switched off. The standard arguments label provided by Trandingview only show input defaults or entries while the compiler blocks attempts to change these with the script, so some other way to inform the user on the actual values for these parameters was needed.
The purpose of these additions is that you can throw the KeltCOG in whatever timeframe without worries about the proper settings. e.g. you can toggle through different timeframes trusting that this channel remains relevant.
You can switch it off in the inputs, you can also just show the number.
It can be taken as a sort of measurement of the volatility, the wider the cannel, the more volatile the price.
I need this feature to limit risk in my system of momentum investing. In this system I use the value of the outerlow ( the purple lowest line of the channel) as stoploss level. I have eight positions in different liquid stocks of equal size. I open a position when the price moves in the blue uptrend area. To limit the risk per trade to 2 % of the total invested finances, the maximum risk of one out of eight equal positions should not be higher 16 %. If the channel is wider than 16 %, I might prefer to use the higher red innerlow, or if the channel is too wide, not take the trade.
Also changes were made to the minimum lookback period for the script setting to 14, the formula for calculating width by the script, The green area is renamed to “prudent buyers area”, the yellow area to “prudent sellers area”.
The first is the option to show the last 20 of a 40 period Hull Moving Average.
Strategy: I am a fan of this line because it is very smooth, doesn’t give many false signals and everything about it has a meaning: its direction (up, sideways or down) and the position of the bars towards this line (under=down, over=up). For me the last 20 will do.
The second feature is the option to reduce the channel to a step line with colored patches. The advantage of this option is that the indicator takes no extra space in the panel, giving a better view of the candles. Disadvantage is that you don’t have values in the price scale.
I use this option in the layout with 4 panels showing 4 different timeframes of an instrument.
In the inputs you find three switches for this option under the Extra Lines heading:
“Show just nearby Fibonacci level and color patches” Switching this on will reduce the channel to a step line and the zones become color patches in which the candle moves, zones in which no candle moves are not shown as patches.
“Toggle supportive / resistive level” If you toggle this, the step line will either have a preference to run below the candles and take the color lime, this is supportive level, or to run above the candles and take the color maroon, this is resistive level. Of course the blue patches are higher than any Fibonacci line and the red patches lower, so when the candle is in such a patch both levels are equal.
“Show both channel and nearby fib level with patches” This is added to reassure the user that one form is really a variation of the other.
Creating this option required a lot of changes in the script code. I added two sets of the six lines of the channel, the values for both sets are calculated and put in variables named F1 through F6 in the top section of the script.
In the middle section I give these values to permanent lines when the proper condition is met, these retain the names Outerhigh through Outerlow and are plotted exactly as in the original script.
In the final section I give these values to patch lines when more complicated conditions are met. I named these conditions CL1 through CL6 to apply to L1 through L6 when these values are given to variables with a somewhat truncated name Outhi through Outlow. These are plotted with the display.none condition, as the plot only serves for the fill command that creates the patches. If the variable has no value, nothing is plotted and nothing is filled, this how the patches are created only when a candle in them. To ensure that there is at least on clickable item in the indicator I created the nearby fib line by checking the before mentioned CL1 throug CL6 conditions again.
In the inputs the text can still be brought back to just the number.
After discovering that the “Supertrend” indicator combines beautifully with the KeltCOG with de setting “show just nearby fibonacci level and color patches” activated, I decided to integrate Supertrend into this option and rename it in “Supertrendmode”.
Integration is easy because the algorithms for KeltCOG and Supertrend use the same settings (i.e. ‘multiplier’ and ‘lookback’) in the same way. I copied lines from the code by Kivanc Ozbilgic (www.tradingview.com/script/r6dAP7yi/) made it work with the KeltCOG settings.
The option "toggle supportive / resistive level" is abolished because now this nearby fifonacci level will automatically turn to supportive and change color to lime if Supertrend indicates uptrend and in downtrend to resistive colored maroon. Because the highlight color for Supertrend is between the “Support/Resistance level” and the Supertrendline, the patches of the channel colors in which the bars run, keep their colors unchanged. The colors or the highlighters are yellowish for the uptrend and reddish for the downtrend.
The inputs are regrouped, now the first option is "toggle channel mode (off) supertrend mode (on)"
The option “use Fibonacci lines as inner high and low” is abolished, the channel now always gives Fibonacci zones.
The use of this mode is the same as for supertrend, but you get the additional information of the relevant Fibonacci level and channel zone. The outside channel situation, which occurs when the market is over enthusiastic or fearful are clearly visible by the absence of patch color.
Added a tool text checkbox for automatic multiplier adjustment
Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.