OPEN-SOURCE SCRIPT

Donchian Channel Oscillator (DonOsc)

Preface
DonOsc stands for Donchian Channel Oscillator. This channel envelopes all prices, so if you set the height of the channel to 100 percent, you can plot the prices as percent in between, creating this sub-pane oscillator. For clarity the example chart shows a Donchian channel in the main-pane with the same look-back as the DonOsc, this way you can see how both are related.
snapshot
Price River
Not only the close is plotted, but also the high and the low of the bar. Thus you get a structure that can be associated with a river, streaming from left to right, in which the price moves between the left bank (i.e. the plotted highs) and the right bank (i.e. the plotted lows), which meanders between the high border (100%) and the low border (0%) of the oscillator. The surface of the price river is gray. The price line is blue when up and dark red when down. The river has also color patches dark red, light red, blue and aqua. Stochastic patches; up: aqua, down: light red
If you look at the price river, you may notice that the price line is closer to the left bank (highs) when moving up and to the right bank (lows) when moving down. Because this phenomenon is used in the stochastic indicator, I named these stochastic patches. These are depicted on the wide side for visibility, so the aqua patches are to the right of the price line and the light-red patches to the left.
Widening patches; up: blue, down: red
If you look at tops or bottoms in bar charts, you may notice that long bars (wide range) tend to be there. You may say that prices turn with a ‘range bang’. This causes a widening of the price river, depicted as a patch on the wide side.
snapshot
Channel Features
High (76.4 %) and low (23.6 %) Fibonacci levels.
In the oscillator there is no need to calculate Fibonacci levels, we can just plot them. If the price is above 50% the low level is shown with a green color, when below the high level with a pink color. When the price river crosses a level a ‘near border’ highlighter will flash, lime near the high border and orange near the low one.
New high and new low markers.
A flaw in the oscillator is that is doesn’t show actual new lows and new highs in the Donchian Channel, because everything is made relative. This is ‘repaired’ by adding markers, dark red for new low depicted between the high fib and border, blue for new high depicted between low fib and border. Used are the same colors as in the widening patches, because new highs and lows also lead to widening of the actual Channel.
Uptrend and downtrend highlighters.
If in the actual Channel the bars run in the upper half, an uptrend is happening as long as these remain there, a downtrend when the bars remain in the lower half. In the oscillator a yellow highlighter flashes when the price is higher than 50%, a red highlighter below 50%.

Interpretation of the DonOsc
This sub-pane indicator provides a wealth of useful information about what is going on in the market. First of all you immediately see whether there is an up or down trend and whether these lead to new highs or lows. Second of all you can estimate the importance of price movements in the context of the look-back period. Thirdly the width of the price river reveals the emotions in the market. The higher the emotions run, the more risk is involved in a postilion in the charted instrument.

Settings of the DonOsc
Look-back settings.
By default the script sets the look-back, depending on the time frame. This overrules the standard manual setting. If you switch this off, the manual setting will work. A feed-back label can by shown which informs about the current setting.
Smoothing
This concerns the price river. Default is 2, if you increase this setting, the river will loose its touch with the channel borders. O.t.o.h. the river wil be wider and better visible. Maximum setting is 5.
Colors
The momentum colors set both the river widening patches and new high and low markers.

Take care, Eykpunter.
Bands and ChannelsdonchianchannelOscillatorsTrend Analysistrendlineanalysis

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal