OPEN-SOURCE SCRIPT

Sylvain Zig-Zag [MyTradingCoder]

This Pine Script version of ZigZagHighLow is a faithful port of Sylvain Vervoort's original study, initially implemented in NinjaScript and later added to the thinkorswim standard library. This indicator identifies and connects swing points in price data, offering a clear visualization of market moves that exceed a specified threshold. Additionally, it now includes features for detecting and plotting support and resistance levels, enhancing its utility for technical analysis.

Overview
The Sylvain Zig-Zag study excels at highlighting significant price swings by plotting points where the price change, combined with volatility adjustments via the Average True Range (ATR), exceeds a user-defined percentage. It effectively smooths out minor fluctuations, allowing traders to focus on the primary market trends. This tool is particularly useful in identifying potential turning points, trends in price movements, and key support and resistance levels, making it a valuable addition to your technical analysis arsenal.

快照

How It Works
The Sylvain Zig-Zag indicator works by detecting swing points in the price data and connecting them to form a zigzag pattern. A swing point is identified when the price moves a certain distance, defined by a combination of percentage change and ATR. This distance must be exceeded for a swing point to be plotted.

When the price moves upwards and exceeds the previous high by a specified percentage plus a factor of the ATR, a new high swing point is plotted. Conversely, a low swing point is plotted when the price moves downwards and exceeds the previous low by the same criteria. This ensures that only significant price moves are considered, filtering out minor fluctuations and providing a clear view of the overall market trend.

In addition to plotting zigzag lines, the indicator can now identify and draw support and resistance levels based on the detected swing points. These levels are crucial for identifying potential reversal areas and market structure.

Key Features
  • Swing Point Detection: Accurately identifies significant price swings by considering both percentage price change and volatility (via Average True Range).
  • Dynamic Support/Resistance: Automatically generates support and resistance lines based on the identified swing points, providing potential areas of price reversals.
  • Customizable Parameters: Tailor the indicator's sensitivity to your preferred trading style and market conditions. Adjust parameters like percentage reversal, ATR settings, and absolute/tick reversals.
  • Visual Clarity: Choose to display the ZigZag line, support/resistance levels, new trend icons, continuation icons, and even customize bar colors for easy visual analysis.

Trading Applications
  • Trend Identification: Easily visualize the prevailing market trend using the direction of the ZigZag line and support/resistance levels.
  • Entry/Exit Signals: Potential entry points can be identified when the price interacts with the dynamic support/resistance levels.
  • Stop-Loss Placement: Use recent swing points as logical places for setting stop-loss orders.
  • Profit Targets: Project potential price targets based on the distance between previous swing points.


快照

Input Parameters
Several input parameters can be adjusted to customize the behavior of the Sylvain Zig-Zag indicator. These parameters allow traders to fine-tune the detection of swing points and support/resistance levels to better suit their trading strategy and the specific market conditions they are analyzing.

High Source and Low Source:
These inputs define the price points used for detecting high and low swing points, respectively. You can choose between high, low, open, or close prices for these calculations.

Percentage Reversal:
This input sets the minimum percentage change in price required for a swing to be detected. A higher percentage value will result in fewer but more significant swing points, while a lower value will detect more frequent, smaller swings.

Absolute Reversal:
This parameter allows for an additional fixed value to be added to the minimum price change and ATR change. This can be useful for increasing the distance between swing points in volatile markets.

ATR Length:
This input defines the period used for calculating the ATR, which is a measure of market volatility. A longer ATR period will smooth out the ATR calculation, while a shorter period will make it more sensitive to recent price changes.

ATR Multiplier:
This factor is applied to the ATR value to adjust the sensitivity of the swing point detection. A higher multiplier will increase the required price movement for a swing point to be plotted, reducing the number of detected swings.

Tick Reversal:
This input allows for an additional value in ticks to be added to the minimum price change and ATR change, providing further customization in the swing point detection process.

Support and Resistance:
  • Show S/R: Enable or disable the plotting of support and resistance levels.
  • Max S/R Levels: Set the maximum number of support and resistance levels to display.
  • S/R Line Width: Adjust the width of the support and resistance lines.


Visual Settings
The Sylvain Zig-Zag indicator also includes visual settings to enhance the clarity of the plotted swing points and trends. You can customize the color and width of the zigzag line, and enable icons to indicate new trends and continuation patterns. Additionally, the bars can be colored based on the detected trend, aiding in quick visual analysis.

Conclusion
This port of the ZigZagHighLow study from NinjaScript to Pine Script preserves the essence of Sylvain Vervoort’s methodology while adding new features for support and resistance. It provides traders with a powerful tool for technical analysis. The combination of price changes and ATR ensures that you have a robust and adaptable tool for identifying key market movements and structural levels. Customize the settings to match your trading style and gain a clearer picture of market trends, turning points, and support/resistance areas. Enjoy improved market analysis and more informed trading decisions with the Sylvain Zig-Zag indicator.
levelsPivot points and levelsZigzagZig Zag Indicator

開源腳本

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

想在圖表上使用此腳本?

免責聲明