PROTECTED SOURCE SCRIPT
Support & Resistance Pro

Input Configuration: Allows selecting 3 timeframes (TF1 weak, TF2 medium, TF3 strong), show/hide levels, pivot parameters (left/right bars), max levels per TF, duplicate tolerance, max level age, colors, line styles, transparency, and line extension.
Helper Functions: Defines line styles (solid/thin/thick/dashed), widths, and colors with transparency. Calculates seconds per timeframe for time adjustments.
Array Management: Uses arrays to store resistance/support levels, times, lines, and labels per TF and type (resistance/support).
Duplicate Detection: Checks if a new level is similar (within tolerance %) to existing levels in any TF to avoid repetitions.
Level Addition: Adds detected high/low pivots if not duplicates or old; creates dynamic lines and labels; limits to maxLevels by removing oldest.
Data Request: Uses request.security to get high/low pivots in higher timeframes, adjusting pivot times by subtracting left bars.
Update on Each Bar: Extends lines to the right (infinite or specific bars) and moves labels to the chart's end.
Dashboard (Table): On the last bar, creates a table in the top-right corner showing the most recent levels per TF (type, level, % distance to close, age in bars), with corresponding colors. Only shows one level per type/TF (the last one).
Alerts: Generates alert conditions when price crosses over resistance or under support in TF3 (strong); can be extended to other TFs.
In summary, it plots multi-timeframe support/resistance levels based on pivots, manages them dynamically, displays info in a table, and alerts on touches at strong levels.
Helper Functions: Defines line styles (solid/thin/thick/dashed), widths, and colors with transparency. Calculates seconds per timeframe for time adjustments.
Array Management: Uses arrays to store resistance/support levels, times, lines, and labels per TF and type (resistance/support).
Duplicate Detection: Checks if a new level is similar (within tolerance %) to existing levels in any TF to avoid repetitions.
Level Addition: Adds detected high/low pivots if not duplicates or old; creates dynamic lines and labels; limits to maxLevels by removing oldest.
Data Request: Uses request.security to get high/low pivots in higher timeframes, adjusting pivot times by subtracting left bars.
Update on Each Bar: Extends lines to the right (infinite or specific bars) and moves labels to the chart's end.
Dashboard (Table): On the last bar, creates a table in the top-right corner showing the most recent levels per TF (type, level, % distance to close, age in bars), with corresponding colors. Only shows one level per type/TF (the last one).
Alerts: Generates alert conditions when price crosses over resistance or under support in TF3 (strong); can be extended to other TFs.
In summary, it plots multi-timeframe support/resistance levels based on pivots, manages them dynamically, displays info in a table, and alerts on touches at strong levels.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.