OPEN-SOURCE SCRIPT

Paytience Distribution

Paytience Distribution Indicator User Guide

Overview:
The Paytience Distribution indicator is designed to visualize the distribution of any chosen data source. By default, it visualizes the distribution of a built-in Relative Strength Index (RSI). This guide provides details on its functionality and settings.

Distribution Explanation:
A distribution in statistics and data analysis represents the way values or a set of data are spread out or distributed over a range. The distribution can show where values are concentrated, values are absent or infrequent, or any other patterns. Visualizing distributions helps users understand underlying patterns and tendencies in the data.

Settings and Parameters:

Main Settings:
  • Window Size
    - Description: This dictates the amount of data used to calculate the distribution.
    - Options: A whole number (integer).
    - Tooltip: A window size of 0 means it uses all the available data.

  • Scale
    - Description: Adjusts the height of the distribution visualization.
    - Options: Any integer between 20 and 499.

  • Round Source
    - Description: Rounds the chosen data source to a specified number of decimal places.
    - Options: Any whole number (integer).

  • Minimum Value
    - Description: Specifies the minimum value you wish to account for in the distribution.
    - Options: Any integer from 0 to 100.
    - Tooltip: 0 being the lowest and 100 being the highest.

  • Smoothing
    - Description: Applies a smoothing function to the distribution visualization to simplify its appearance.
    - Options: Any integer between 1 and 20.

  • Include 0
    - Description: Dictates whether zero should be included in the distribution visualization.
    - Options: True (include) or False (exclude).

  • Standard Deviation
    - Description: Enables the visualization of standard deviation, which measures the amount of variation or dispersion in the chosen data set.
    - Tooltip: This is best suited for a source that has a vaguely Gaussian (bell-curved) distribution.
    - Options: True (enable) or False (disable).

  • Color Options
    - High Color and Low Color: Specifies colors for high and low data points.
    - Standard Deviation Color: Designates a color for the standard deviation lines.


Example Settings:
  • Example Usage RSI
    - Description: Enables the use of RSI as the data source.
    - Options: True (enable) or False (disable).

  • RSI Length
    - Description: Determines the period over which the RSI is calculated.
    - Options: Any integer greater than 1.


Using an External Source:
To visualize the distribution of an external source:
  • Select the "Move to" option in the dropdown menu for the Paytience Distribution indicator on your chart.
  • Set it to the existing panel where your external data source is placed.
  • Navigate to "Pin to Scale" and pin the indicator to the same scale as your external source.


Indicator Logic and Functions:
  • Sinc Function: Used in signal processing, the sinc function ensures the elimination of aliasing effects.
  • Sinc Filter: A filtering mechanism which uses sinc function to provide estimates on the data.
  • Weighted Mean & Standard Deviation: These are statistical measures used to capture the central tendency and variability in the data, respectively.


Output and Visualization:
The indicator visualizes the distribution as a series of colored boxes, with the intensity of the color indicating the frequency of the data points in that range. Additionally, lines representing the standard deviation from the mean can be displayed if the "Standard Deviation" setting is enabled.

The example RSI, if enabled, is plotted along with its common threshold lines at 70 (upper) and 30 (lower).

Understanding the Paytience Distribution Indicator

1. What is a Distribution?
A distribution represents the spread of data points across different values, showing how frequently each value occurs. For instance, if you're looking at a stock's closing prices over a month, you may find that the stock closed most frequently around $100, occasionally around $105, and rarely around $110. Graphically visualizing this distribution can help you see the central tendencies, variability, and shape of your data distribution. This visualization can be essential in determining key trading points, understanding volatility, and getting an overview of the market sentiment.

2. The Rounding Mechanism
Every asset and dataset is unique. Some assets, especially cryptocurrencies or forex pairs, might have values that go up to many decimal places. Rounding these values is essential to generate a more readable and manageable distribution.

  • Why is Rounding Needed? If every unique value from a high-precision dataset was treated distinctly, the resulting distribution would be sparse and less informative. By rounding off, the values are grouped, making the distribution more consolidated and understandable.

  • Adjusting Rounding: The `Round Source` input allows users to determine the number of decimal places they'd like to consider. If you're working with an asset with many decimal places, adjust this setting to get a meaningful distribution. If the rounding is set too low for high precision assets, the distribution could lose its utility.


3. Standard Deviation and Oscillators
Standard deviation is a measure of the amount of variation or dispersion of a set of values. In the context of this indicator:

  • Use with Oscillators: When using oscillators like RSI, the standard deviation can provide insights into the oscillator's range. This means you can determine how much the oscillator typically deviates from its average value.

  • Setting Bounds: By understanding this deviation, traders can better set reasonable upper and lower bounds, identifying overbought or oversold conditions in relation to the oscillator's historical behavior.


4. Resampling

Resampling is the process of adjusting the time frame or value buckets of your data. In the context of this indicator, resampling ensures that the distribution is manageable and visually informative.

Resample Size vs. Window Size: The `Resample Resolution` dictates the number of bins or buckets the distribution will be divided into. On the other hand, the `Window Size` determines how much of the recent data will be considered. It's crucial to ensure that the resample size is smaller than the window size, or else the distribution will not accurately reflect the data's behavior.

Why Use Resampling? Especially for price-based sources, setting the window size around 500 (instead of 0) ensures that the distribution doesn't become too overloaded with data. When set to 0, the window size uses all available data, which may not always provide an actionable insight.

5. Uneven Sample Bins and Gaps

You might notice that the width of sample bins in the distribution is not uniform, and there can be gaps.

Reason for Uneven Widths: This happens because the indicator uses a 'resampled' distribution. The width represents the range of values in each bin, which might not be constant across bins. Some value ranges might have more data points, while others might have fewer.

Gaps in Distribution: Sometimes, there might be no data points in certain value ranges, leading to gaps in the distribution. These gaps are not flaws but indicate ranges where no values were observed.

In conclusion, the Paytience Distribution indicator offers a robust mechanism to visualize the distribution of data from various sources. By understanding its intricacies, users can make better-informed trading decisions based on the distribution and behavior of their chosen data source.
distributioneducationalpaytiencePine utilitiesstatistics

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?


Get Access To Our Premium Paytience Indicators: paytience.io

All scripts & content provided by Paytience are for informational & educational purposes only. Past performance does not guarantee future results. 🦉
Also on:

Disclaimer