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

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明