PROTECTED SOURCE SCRIPT

DCT ATR Calculator

由HeboUp提供
This TradingView Pine Script indicator, named "DCT ATR Calculator" is designed to calculate and visualize key volatility metrics, specifically the Average True Range (ATR), and provide detailed True Range (TR) values for multiple recent daily candles. The script also includes features for comparing the current symbol's volatility with that of other predefined symbols and visualizing key price levels on the chart.

#### Key Features and Functionality:

1. **True Range (TR) Calculation:**
- The script computes the True Range (TR) for the current symbol based on the absolute difference between the current close price and the previous close price.
- It retrieves TR values for the past 10 daily candles using the `request.security` function to get daily data.

2. **True Range Thresholds:**
- Users can set a threshold for TR values to filter and compare volatility across different symbols.
- The script allows configuration for up to five different symbols, each with its own TR threshold, such as `DAX`, `NDQM`, `DJI`, `ETHUSDT`, and `BTCUSDT`.

3. **Threshold-Based TR Selection:**
- It assigns the TR values below the defined thresholds to variables representing the smallest to the fifth smallest TR values.
- These values are then summed to compute the Average True Range (ATR) for the current symbol.

4. **Visualizations:**
- **Daily High, Low, and Open Lines:**
- The script can draw lines on the chart to indicate the daily high, low, and open prices. Users can customize the color and width of these lines through input options.
- **ATR Lines:**
- ATR-based lines are plotted above and below the daily open price. These lines are dashed and their positions are determined based on the ATR value.

5. **Tables for Data Display:**
- **TR Table:**
- A table in the top-right corner of the chart displays the TR values for the past five daily candles and the computed ATR.
- **ATR Comparison Table:**
- A table in the bottom-right corner shows the current ATR value and compares it with the TR used, highlighting whether the current close price is above or below the daily open.

6. **Background Color Coding:**
- The chart background color changes based on the comparison between the current close price and the daily open price. It turns green if the close is above the daily open, red if below, and gray if equal.

#### How to Use:

- **Configuration:**
- Set the TR threshold for comparison with other symbols using the `trThresh` input.
- Define the symbols and their respective TR thresholds through the provided input fields.

- **Customization:**
- Adjust line colors and widths for daily high, low, and open prices, as well as ATR lines, using the input options.
- Toggle the visibility of daily high/low lines and ATR lines via the checkboxes.

- **Interpretation:**
- Use the tables and visual lines to assess volatility and price levels.
- Compare the ATR values to gauge market volatility relative to historical TR values for the selected symbols.

This script provides a comprehensive tool for analyzing and comparing market volatility across multiple symbols, assisting traders in making informed decisions based on historical volatility and current price behavior.
Fundamental AnalysisTrend AnalysisVolatility

受保护脚本

该脚本是闭源发布的,您可以自由使用它。您可以收藏它以在图表上使用。您无法查看或修改其源代码。

想在图表上使用此脚本?

免责声明