PINE LIBRARY

Volatility_ZigZag_Library

Aggiornato
This is a Pine Script library for the public indicator "Volatility ZigZag" by brettkind. For further description, please refer to the information available on the original indicator page.

Library "Volatility_ZigZag_Library"

getValues_andStyling_VolatilityZigZag_byBrettkind(hl_src, SOURCE, length, min_dev_input, stdev_fctr, ZigZag, zz_color, zz_width, zz_devline, zz_points, zz_alert_sign, ZZ_Label, ZZ_Label_clr, rev_text, zz_bars_text, pcabs_text, avg_pcabs_text, pcrel_text, avg_pcrel_text, vol_text, avg_vol_text, input_currency)
  Parameters:
    hl_src (bool)
    SOURCE (float)
    length (int)
    min_dev_input (float)
    stdev_fctr (float)
    ZigZag (bool)
    zz_color (color)
    zz_width (int)
    zz_devline (bool)
    zz_points (bool)
    zz_alert_sign (bool)
    ZZ_Label (bool)
    ZZ_Label_clr (color)
    rev_text (bool)
    zz_bars_text (bool)
    pcabs_text (bool)
    avg_pcabs_text (bool)
    pcrel_text (bool)
    avg_pcrel_text (bool)
    vol_text (bool)
    avg_vol_text (bool)
    input_currency (string)

getStatisticTable_VolatilityZigZag_byBrettkind(x1, Y1_array, draw_tbl)
  Parameters:
    x1 (int)
    Y1_array (array<float>)
    draw_tbl (bool)
Note di rilascio
The Volatility ZigZag Indicator is an advanced tool developed in Pine Script to identify key pivot points in price movements and draw ZigZag lines based on volatility and price changes. Unlike the traditional ZigZag indicator, which relies on fixed deviations, this indicator utilizes various volatility measures such as standard deviation, True Range, and Average True Range to dynamically determine more precise pivot points. This indicator offers a variety of customization options, allowing traders to better understand market structure through the lens of volatility and price movements, enabling them to adjust their trading strategies accordingly.

Key Features:
ZigZag Lines: The indicator draws lines between pivot points defined by significant price changes or volatility measures.
Customizable Parameters: Users can adjust parameters such as data source, length, deviation, line style, and labeling options.
Volatility-Based Pivot Points: Pivot points are calculated based on standard deviation, true range, average true range, and a selectable-user-parameter minimum deviation.
Labels and Annotations: The indicator labels pivot points with information on price changes, volume, and the number of bars between pivot points.
Notification Function: There is an integrated alert function that can trigger notifications when new pivot points are formed.

Labeled Data Points:
Price Change: Indicates the absolute and average percentage change between two pivot points. The geometric mean is used for average percentage change because it is better suited for aggregating percentage changes across different periods. Price Change values indicate the magnitude of price movements between pivot points. Higher values suggest more significant price changes, while lower values indicate smaller fluctuations.
Volume: Shows the total and average volume between two pivot points. Interpret within the context of market liquidity and trading activity to gauge the strength of price movements.
Number of Bars: Indicates the number of bars between the current and the last pivot point. Represents the duration of price movements between the current and the last pivot point. Interpret cautiously, considering the pace of market shifts and the significance of timing in trend analysis.
Reversal Price: Displays the price of the reversal point (previous pivot). Displays the price of the previous pivot, providing insight into potential trend reversals.

Standard Deviation and Volatility Measures:
Standard Deviation: A statistical measure that describes the dispersion of price values around the mean. It helps quantify the price volatility.
True Range (TR): The difference between the highest and lowest price of a period, including gaps in the price movement.
Average True Range (ATR): A moving average of the True Range, representing the average volatility over a specified period.
The Deviation H-Line in the Volatility ZigZag indicator dynamically adjusts based on whether the last pivot point was a high or low. When the price crosses this line, a new ZigZag pivot point is signaled, potentially indicating a trend reversal.

Calculation of Pivot Points:
A pivot point is established when the price exceeds a predefined deviation threshold. This deviation is defined as a dynamic value (volatility) or fixed amount based on deviation. If the trend moves sufficiently in the opposite direction and the price crosses the certain threshold, a new pivot point is marked.
Pivot points can be high or low points in the price movement.

Parameter and Data Source
Typically, high and/or low values are used for price data.
• Standard Deviation Calculation: Based on the default source, usually the closing price, or another selected source.
• True Range (TR): The difference between the highest and lowest price of a period, including gaps in the price movement (if high/low source is selected).
• Average True Range (ATR): A moving average of the True Range, representing the average volatility over a specified period (if high/low source is selected).
Length: Determines the number of bars considered for calculations, especially for standard deviation or Average True Range.
Minimum Deviation: Optional setting to establish a minimum deviation for ZigZag lines.
Standard Deviation Factor: Adjustable parameter for the standard deviation.

Notice
The Volatility ZigZag indicator cannot identify future levels because it relies on historical price data and volatility measures to determine pivot points. It reacts only after sufficient price movements have occurred that exceed a predetermined deviation. As a result, pivot points and corresponding ZigZag lines can only be determined retrospectively, after the necessary price changes have already happened. This backward-looking approach makes it impossible to predict future price movements or pivot points.

This is a Pine Script library for the public indicator "Volatility ZigZag" by brettkind. For further description, please refer to the information available on the original indicator page.

New
The "◯" points have been repositioned to the same Y-coordinate as “⦿”, but the X-coordinate corresponds to the point where the condition for a new ZigZag is true.
The ZigZag label text-size is adjustable from “tiny” to “huge” or “auto”.
Note di rilascio
v3
Note di rilascio
I would like to point out that this indicator was developed for daily or weekly charts. Of course, it is also possible to use this indicator in other time frames, but errors could then occur when extremely volatile price changes. However, in most cases these can be remedied by experimenting with the settings.

New Input-Option "min_pvt_length" was build for the tool-window.
A "bug" with the Deviation-Line Drawing was fixed.
New statistic row with the average count of bars of a ZigZag-Line was implemented.
It is now also possible to plot the deviation line (as a series type) in order to better understand the condition for the appearance of a new ZigZag pivot point.

v4

Aktualisiert:
getValues_andStyling_VolatilityZigZag_byBrettkind(hl_src, SOURCE, length, min_dev_input, pvt_length, stdev_fctr, ZigZag, zz_color, zz_width, zz_devline, zz_points, zz_alert_sign, ZZ_Label, ZZ_Label_clr, rev_text, zz_bars_text, pcabs_text, avg_pcabs_text, pcrel_text, avg_pcrel_text, vol_text, avg_vol_text, text_size, input_currency)
  Parameters:
    hl_src (bool)
    SOURCE (float)
    length (int)
    min_dev_input (float)
    pvt_length (int)
    stdev_fctr (float)
    ZigZag (bool)
    zz_color (color)
    zz_width (int)
    zz_devline (bool)
    zz_points (bool)
    zz_alert_sign (bool)
    ZZ_Label (bool)
    ZZ_Label_clr (color)
    rev_text (bool)
    zz_bars_text (bool)
    pcabs_text (bool)
    avg_pcabs_text (bool)
    pcrel_text (bool)
    avg_pcrel_text (bool)
    vol_text (bool)
    avg_vol_text (bool)
    text_size (string)
    input_currency (string)

getStatisticTable_VolatilityZigZag_byBrettkind(x1, Y1_array, number_of_bars_array, draw_tbl)
  Parameters:
    x1 (int)
    Y1_array (array<float>)
    number_of_bars_array (array<int>)
    draw_tbl (bool)
Note di rilascio
v5: dev_Y2_series is fixed.
debuggingpricechangevolatiltyvolumenZigzag

Libreria Pine

In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Un saluto all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.

Declinazione di responsabilità