OPEN-SOURCE SCRIPT

Custom Zig Zag with Absolute Price Difference

This Zig-Zag indicator visualizes the price movements of a financial instrument and highlights the relevant turning points (pivots) where the price has undergone a significant change. It uses a deviation threshold to mark only substantial movements and ignore minor fluctuations.

The input parameters allow the user to customize the indicator:

Deviation (%): Defines the minimum percentage deviation required to mark a turning point.
Depth: Specifies how many periods before and after a pivot are considered to determine whether it is a real high or low.
Line Color: Allows the user to change the color of the lines that connect the pivots.
Extend to Last Bar: If enabled, extends the last lines to the current bar.
Display Absolute Price Difference: If enabled, the indicator shows the absolute price difference between the current pivot and the previous one.
Label Size: Allows adjusting the font size of the displayed labels.
The logic of the indicator is based on calculating pivots (highs and lows) using price movements. The indicator then tracks the changes between successive pivots and represents them as lines. When the price shows a significant difference from the last pivot (measured in percentage), a line is drawn, and a label displaying the price difference is shown.

Additionally, the indicator uses the calc_dev function to compute the price deviation between the last pivot and the current price. This provides users with a clear visualization of price changes, helping to identify larger price movements.






Candlestick analysisChart patternsCycles

Script de código abierto

Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

¿Quiere utilizar este script en un gráfico?

Exención de responsabilidad