LucF

Oscillator Workbench — Chart [LucF]

LucF Premium Aktualisiert   
█ OVERVIEW


This indicator uses an on-chart visual framework to help traders with the interpretation of any oscillator's behavior. The advantage of using this tool is that you do not need to know all the ins and outs of a particular oscillator such as RSI , CCI , Stochastic , etc. Your choice of oscillator and settings in this indicator will change its visuals, which allows you to evaluate different configurations in the context of how the workbench models oscillator behavior. My hope is that by using the workbench, you may come up with an oscillator selection and settings that produce visual cues you find useful in your trading.

The workbench works on any symbol and timeframe. It uses the same presentation engine as my Delta ​Volume Channels indicator; those already familiar with it will feel right at home here.



█ CONCEPTS


Oscillators

An oscillator is any signal that moves up and down a centerline. The centerline value is often zero or 50. Because the range of oscillator values is different than that of the symbol prices we look at on our charts, it is usually impossible to display an oscillator on the chart, so we typically put oscillators in a separate pane where they live in their own space. Each oscillator has its own profile and properties that dictate its behavior and interpretation. Oscillators can be bounded, meaning their values oscillate between fixed values such as 0 to 100 or +1 to -1, or unbounded when their maximum and minimum values are undefined.


Oscillator weight

How do you display an oscillator's value on a chart showing prices when both values are not on the same scale? The method I use here converts the oscillator's value into a percentage that is used to weigh a reference line. The weight of the oscillator is calculated by maintaining its highest and lowest value above and below its centerline since the beginning of the chart's history. The oscillator's relative position in either of those spaces is then converted to a percentage, yielding a positive or negative value depending on whether the oscillator is above or below its centerline. This method works equally well with bounded and unbounded oscillators.


Oscillator Channel

The ​​oscillator channel is the space between two moving averages: the reference line and a weighted version of that line. The reference line is a moving average of a type, source and length which you select. The weighted line uses the same settings, but it averages the oscillator-weighted price source.

The weight applied to the source of the reference line can also include the relative size of the bar's ​volume in relation to previous bars. The effect of this is that the oscillator's weight on bars with higher total ​volume will carry greater weight than those with lesser ​volume.

The ​oscillator channel can be in one of four states, each having its corresponding color:
 • Bull (teal): The weighted line is above the reference line.
 • Strong bull (lime): The bull condition is fulfilled and the bar's close is above the reference line and both the reference and the weighted lines are rising.
 • Bear (maroon): The weighted line is below the reference line.
 • Strong bear (pink): The bear condition is fulfilled and the bar's close is below the reference line and both the reference and the weighted lines are falling.


Divergences

In the context of this indicator, a divergence is any bar where the slope of the reference line does not match that of the weighted line. No directional bias is assigned to divergences when they occur. You can also choose to define divergences as differences in polarity between the oscillator's slope and the polarity of close-to-close values. This indicator's divergences are designed to identify transition levels. They have no polarity; their ​bullish/​bearish bias is determined by the behavior of price relative to the divergence channel after the divergence channel is built.


Divergence Channel

The divergence channel is the space between two levels (by default, the bar's low and high) saved when divergences occur. When price has breached a channel and a new divergence occurs, a new channel is created. Until that new channel is breached, bars where additional divergences occur will expand the channel's levels if the bar's price points are outside the channel.

Price breaches of the divergence channel will change its state. Divergence channels can be in one of five different states:
 • Bull (teal): Price has breached the channel to the upside.
 • Strong bull (lime): The bull condition is fulfilled and the ​oscillator channel is in the strong bull state.
 • Bear (maroon): Price has breached the channel to the downside.
 • Strong bear (pink): The bear condition is fulfilled and the ​oscillator channel is in the strong bear state.
 • Neutral (gray): The channel has not been breached.



█ HOW TO USE THE INDICATOR


Load the indicator on an active chart (see here if you don't know how).

The default configuration displays:
 • The Divergence channel's levels.
 • Bar colors using the state of the ​oscillator channel.

The default settings use:
 • RSI as the oscillator, using the close source and a length of 20 bars.
 • An Arnaud-Legoux moving average on the close and a length of 20 bars as the reference line.
 • The weighted version of the reference line uses only the oscillator's weight, i.e., without the relative ​volume's weight.
  The weighted line is capped to three standard deviations of the reference.
 • The divergence channel's levels are determined using the high and low of the bars where divergences occur.
  Breaches of the channel require a bar's low to move above the top of the channel, and the bar's high to move below the channel's bottom.

No markers appear on the chart; if you want to create alerts from this script, you will need first to define the conditions that will trigger the markers, then create the alert, which will trigger on those same conditions.

To learn more about how to use this indicator, you must understand the concepts it uses and the information it displays, which requires reading this description. There are no videos to explain it.



█ FEATURES


The script's inputs are divided in five sections: "Oscillator", "Oscillator channel", "Divergence channel", "Bar Coloring" and "Marker/Alert Conditions".


Oscillator

This is where you configure the oscillator you want to study. Thirty oscillators are available to choose from, but you can also use an oscillator from another indicator that is on your chart, if you want. When you select an external indicator's plot as the oscillator, you must also specify the value of its centerline.


Oscillator Channel

Here, you control the visibility and colors of the reference line, its weighted version, and the oscillator channel between them.

You also specify what type of moving average you want to use as a reference line, its source and its length. This acts as the ​oscillator channel's baseline. The weighted line is also a moving average of the same type and length as the reference line, except that it will be calculated from the weighted version of the source used in the reference line. By default, the weighted line is capped to three standard deviations of the reference line. You can change that value, and also elect to cap using a multiple of ATR instead. The cap provides a mechanism to control how far the weighted line swings from the reference line. This section is also where you can enable the relative ​volume component of the weight.


Divergence Channel

This is where you control the appearance of the divergence channel and the key price values used in determining the channel's levels and breaching conditions. These choices have an impact on the behavior of the channel. More generous level prices like the default low and high selection will produce more conservative channels, as will the default choice for breach prices.

In this section, you can also enable a mode where an attempt is made to estimate the channel's bias before price breaches the channel. When it is enabled, successive increases/decreases of the channel's top and bottom levels are counted as new divergences occur. When one count is greater than the other, a bull/bear bias is inferred from it. You can also change the detection mode of divergences, and choose to display a mark above or below bars where divergences occur.


Bar Coloring

You specify here:
 • The method used to color chart bars, if you choose to do so.
 • If you want to hollow out the bodies of bars where ​volume has not increased since the last bar.


Marker/Alert Conditions

Here, you specify the conditions that will trigger up or down markers. The trigger conditions can include a combination of state transitions of the ​oscillator and the divergence channels. The triggering conditions can be filtered using a variety of conditions.

Configuring the marker conditions is necessary before creating an alert from this script, as the alert will use the marker conditions to trigger.

Realtime values will repaint, as is usually the case with oscillators, but markers only appear on bar closes, so they will not repaint. Keep in mind, when looking at markers on historical bars, that they are positioned on the bar when it closes — NOT when it opens.


Raw values

The raw values calculated by this script can be inspected using the Data Window, including the oscillator's value and the weights.



█ INTERPRETATION


Except when mentioned otherwise, this section's charts use the indicator's default settings, with different visual components turned on or off.

The aim of the ​oscillator channel is to provide a visual representation of an oscillator's general behavior. The simplest characteristic of the channel is its bull/bear state, determined by whether the weighted line is above or below the reference line. One can then distinguish between its bull and strong bull states, as transitions from strong bull to bull states will generally happen when trends are losing steam. While one should not infer a reversal from such transitions, they can be a good place to tighten stops. Only time will tell if a reversal will occur. One or more divergences will often occur before reversals. This shows the oscillator channel, with the reference line and the thicker, weighted line:
The nature of the divergence channel's design makes it particularly adept at identifying consolidation areas if its settings are kept on the conservative side. The divergence channel will also reveal transition areas. A gray divergence channel should usually be considered a no-trade zone. More adventurous traders can use the oscillator ​ channel to orient their trade entries if they accept the risk of trading in a neutral divergence channel, which by definition will not have been breached by price. This show only the divergence channels:
This chart shows divergence channels and their levels, and colors bars on divergences and on the state of the oscillator channel, which is not visible on the chart:
If your charts are already busy with other stuff you want to hold on to, you could consider using only the chart bar coloring component of this indicator. Here we only color bars using the combined state of the oscillator and divergence channel, and we do not color the bodies of bars where ​volume has not increased. Note that my chart's settings do not color the candle bodies:
At its simplest, one way to use this indicator would be to look for overlaps of the strong bull/bear colors in both the ​oscillator channel and a divergence channel, as these identify points where price is breaching the divergence channel when the oscillator's state is consistent with the direction of the breach.


Tip

One way to use the Workbench is to combine it with my Delta ​Volume Channels indicator. If both indicators use the same MA as a reference line, you can display its delta ​volume channel instead of the oscillator channel.

This chart shows such a setup. The Workbench displays its divergence levels, the weighted reference line using the default ​RSI oscillator, and colors bars on divergences. The ​DV Channels indicator only displays its delta ​volume channel, which uses the same MA as the workbench for its baseline. This way you can ascertain the ​volume delta situation in contrast with the visuals of the Workbench:


█ LIMITATIONS


 • For some of the oscillators, assumptions are made concerning their different parameters when they are more complex than just a source and length.
  See the `oscCalc()` function in this indicator's code for all the details, and ask me in a comment if you can't find the information you need.
 • When an oscillator using ​volume is selected and no ​volume information is available for the chart's symbol, an error will occur.
 • The method I use to convert an oscillator's value into a percentage is fragile in the early history of datasets
  because of the nascent expression of the oscillator's range during those early bars.


█ NOTES


Working with this workbench

This indicator is called a workbench for a reason; it is designed for traders interested in exploring its behavior with different oscillators and settings, in the hope they can come up with a setup that suits their trading methodology. I cannot tell you which setup is the best because its setup should be compatible with your trading methodology, which may require faster or slower transitions, thus different configurations of the settings affecting the calculations of the divergence channels.


For Pine Script™ Coders

 • This script uses the new overload of the fill() function which now makes it possible to do vertical gradients in Pine. I use it for both channels displayed by this script.
 • I use the new arguments for plot()'s `display` parameter to control where the script plots some of its values,
  namely those I only want to appear in the script's status line and in the Data Window.
 • I used my ta library for some of the oscillator calculations and helper functions.
 • I also used TradingView's ta library for other oscillator calculations.
 • I wrote my script using the revised recommendations in the Style Guide from the Pine v5 User Manual.
Versionshinweise:
v2
Tidied up some code. No functional changes.
Versionshinweise:
v3
I have added the possibility of mixing up to three oscillators to calculate the oscillator weight. You can now choose a second oscillator from the list of oscillators included in the Workbench. The external indicator selection can also be added as a third oscillator to be included in the weight calculation. If you only want the external oscillator to count, remember to select "None" for the "Oscillator 1" and "Oscillator 2" choices. The weight of multiple oscillators is always equally distributed. The individual weight of each oscillator selection is displayed in the Data Window.

Some oscillator names are now suffixed with an "S" or "L" in parentheses. This tells you when the oscillator's calculation will use the "Source" or "Length" field's content.

My Signs of the Times oscillator was added to the list.

The choice to include a relative ​volume component in the weight was moved to the top portion of "Inputs".

"The stock market is a device for transferring money from the impatient to the patient."
— Buffet

https://www.tradingview.com/u/PineCoders/
https://www.tradingview.com/u/TradingView/
Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?