Editors' picks
OPEN-SOURCE SCRIPT

Oscillator Scatterplot Analysis [Trendoscope®]

In this indicator, we demonstrate how to plot oscillator behavior of oversold-overbought against price movements in the form of scatterplots and perform analysis. Scatterplots are drawn on a graph containing x and y-axis, where x represent one measure whereas y represents another. We use the library Graph to collect the data and plot it as scatterplot.

Pictorial explanation of components is defined in the chart below.
snapshot

🎲 This indicator performs following tasks

  1. Calculate and plot oscillator
  2. Identify oversold and overbought areas based on various methods
  3. Measure the price and bar movement from overbought to oversold and vice versa and plot them on the chart.


In our example,
  • The x-axis represents price movement. The plots found on the right side of the graph has positive price movements, whereas the plots found on the left side of the graph has negative price movements.
  • The y-axis represents the number of bars it took for reaching overbought to oversold and/or oversold to overbought. Positive bars mean we are measuring oversold to overbought, whereas negative bars are a measure of overbought to oversold.


🎲 Graph is divided into 4 equal quadrants

  • Quadrant 1 is the top right portion of the graph. Plots in this quadrant represent the instances where positive price movement is observed when the oscillator moved from oversold to overbought
  • Quadrant 2 is the top left portion of the graph. Plots in this quadrant represent the instances where negative price movement is observed when the oscillator moved from oversold to overbought.
  • Quadrant 3 is the bottom left portion of the chart. Plots in this quadrant represent the instances where negative price movement is observed when the oscillator moved from overbought to oversold.
  • Quadrant 4 is the bottom right portion of the chart. Plots in this quadrant represent the instances where positive price movement is observed when the oscillator moved from overbought to oversold.


🎲 Indicator components in Detail
Let's dive deep into the indicator.

🎯 Oscillator Selection
Select the Oscillator and define the overbought oversold conditions through input settings
snapshot

  • Indicator - Oscillator base used for performing analysis
  • Length - Loopback length on which the oscillator is calculated
  • OB/OS Method - We use Bollinger Bands, Keltener Channel and Donchian channel to calculate dynamic overbought and oversold levels instead of static 80-10. This is also useful as other type of indicators may not be within 0-100 range.
  • Length and Multiplier are used for the bands for calculating Overbought/Oversold boundaries.


🎯 Define Graph Properties
Select different graph properties from the input settings that will instruct how to display the scatterplot.
snapshot

  • Type - this can be either scatterplot or heatmap. Scatterplot will display plots with specific transparency to indicate the data, whereas heatmap will display background with different transparencies.
  • Plot Color - this is the color in which the scatterplot or heatmap is drawn
  • Plot Size - applicable mainly for scatterplot. Since the character we use for scatterplot is very tiny, the large at present looks optimal. But, based on the user's screen size, we may need to select different sizes so that it will render properly.
  • Rows and Columns - Number of rows and columns allocated per quadrant. This means, the total size of the chart is 2X rows and 2X columns. Data sets are divided into buckets based on the number of available rows and columns. Hence, changing this can change the appearance of the overall chart, even though they are representing the same data. Also, please note that tables can have max 10000 cells. If we increase the rows and columns by too much, we may get runtime errors.
  • Outliers - this is used to exclude the extreme data. 20% outlier means, the chart will ignore bottom 20% and top 20% when defining the chart boundaries. However, the extreme data is still added to the boundaries.
hewhomustnotbenamedOscillatorsstatisticstrendoscope

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer