Seeking Expertise in Debugging ATR Calculation in TradingView Pine-Script Indicator
Оплачивается при доставке
I am encountering an issue with the Average True Range (ATR) calculation within a custom TradingView indicator. The indicator calculates the main pivot price level for a symbol during a specific time period session and subsequently determines support and resistance levels based on fixed percentages of the daily ATR for that symbol.
- The strategy triggers alerts on either custom session open or close.
- The Current Day Daily ATR value, computed from a lower time frame using the `[login to view URL]` function, is utilized to draw Support and Resistance lines at specific levels (x%) away from the main pivot price level.
Upon triggering an alert and calculating the Support and Resistance levels based on the current day daily ATR available at the time of the alert triggering, I have observed that the Support and Resistance levels change afterwards due to the current day daily ATR fluctuating afterwards. This is problematic as the levels must remain constant after the initial calculation until the next custom session alert is activated the following trading day and then a new Pivot and Support and Resistance levels levels are generated
I initially suspected a repainting issue and, following advice from TradingView support, switched to using the `f_security` function instead of the `[login to view URL]` function. However, the issue persists.
I am seeking assistance in debugging and resolving this issue, focusing on the line of code where the ATR value is computed. The goal is to ensure the stability of the Support and Resistance levels throughout the session until the next alert the following trading day when the next session occurs --meaning when the Support and Resistance levels are initially calculated from the current day daily ATR available at the time the alert is triggered the Support and Resistance price levels calculated will remain the same on the chart even though the Current Day Daily ATR may fluctuate afterwards until the next alert the following trading day when the next session occurs
Please reach out if you possess the Tradingview pinescript expertise to address this issue
ID проекта: #37251812