Support & Resistance: The indicator identifies potential support and resistance levels based on a zigzag pattern. It uses a "depth" and "deviation" input to determine the swings in price that define the zigzag. You can choose to display these levels as either lines or boxes.
TrendBars: The indicator also calculates and displays TrendBars, which are bars colored green for uptrends and red for downtrends. This is based on a calculation involving the difference between the current price and the price 'per' periods ago, smoothed by an adaptive average period.
Diagonal Lines: The script draws diagonal lines connecting the zigzag turning points. These lines visualize the overall trend and can also have support and resistance lines plotted along them.
Inputs and Customization:
The script offers a wide array of customization options through its inputs:
Current S/R Setting:
Horizontal type: Choose between displaying support/resistance as boxes or lines. Depth: The lookback period for identifying swing highs and lows for the zigzag calculation. Higher values mean fewer, stronger levels. Deviation: The minimum price change required to define a new swing in the zigzag. Higher values mean fewer swings. Color: The color of the horizontal support/resistance lines or boxes. Extend lines: Extends the horizontal support/resistance lines to the right edge of the chart. Line count: The maximum number of horizontal support/resistance lines or boxes to display. Diagonal Line Setting:
Line thickness: The thickness of the diagonal zigzag lines. Line style: The style of the diagonal zigzag lines (solid, dotted, dashed). Diagonal color: The color of the main diagonal zigzag line. Zigzag count: The maximum number of diagonal zigzag lines to display. Diagonal high color: Color for diagonal support/resistance lines related to highs. Diagonal low color: Color for diagonal support/resistance lines related to lows. Diagonal S/R line count: The number of support/resistance lines drawn along the diagonal. Show diagonal S/R lines: Toggles the display of the diagonal support/resistance lines. Basic Settings (TrendBars):
Source: The price source to use for the TrendBars calculation (e.g., close, open, high, low). Period: The period used in the TrendBars calculation. UI Options (TrendBars):
Color bars?: Toggles the coloring of the bars based on the TrendBars calculation. How it Works (Simplified):
Zigzag Calculation: The f_zigzag function identifies swing highs and lows based on the depth and deviation inputs.
Support/Resistance Levels: Horizontal lines or boxes are drawn at the identified swing points.
Diagonal Lines: The f_addDiagonalLine function connects the zigzag turning points with diagonal lines.
TrendBars Calculation: The script calculates a smoothed trend based on price changes over the specified period and colors the bars accordingly.
Drawing: The script uses line.new, box.new, and label.new to draw the support/resistance levels, diagonal lines, and labels on the chart.
Key Features:
Dynamic Support/Resistance: The levels are recalculated as new price data becomes available. Customizable: The numerous inputs allow you to tailor the indicator to your specific needs. TrendBars Integration: Combines support/resistance with a trend indicator for a more comprehensive view. Uses:
This indicator can be used to:
Identify potential areas of support and resistance. Visualize the overall trend. Confirm trend changes. Potentially identify entry and exit points. Limitations:
Repainting: Like many zigzag-based indicators, this one can repaint. This means that the levels may adjust as new bars close, potentially changing the appearance of past signals. Be cautious when using it for backtesting or real-time trading decisions. Subjectivity: The zigzag calculation involves parameters that can be subjective and may require experimentation to find optimal settings for different markets and timeframes. False Signals: No indicator is perfect, and this one can also generate false signals. Use it in conjunction with other indicators and your own analysis. This detailed description should give you a good understanding of how the indicator works and how to use it. Remember to experiment with the different settings to find what works best for you.
Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.