OPEN-SOURCE SCRIPT

ATH/ATL tracker

Cập nhật
This script calculates and displays in a table in realtime:
- ATH, date of occurrence, and that price/current price
- ATL, date of occurrence, and that price/current price
- ATH of the current year, date of occurrence, and that price/current price
- ATL of the current year, date of occurrence, and that price/current price
Phát hành các Ghi chú
This script calculates and displays in a table in realtime:
- ATH, date of occurrence, and that price/current price
- ATL, date of occurrence, and that price/current price
- ATH of the current year, date of occurrence, and that price/current price
- ATL of the current year, date of occurrence, and that price/current price
It can also display ATH and ATL levels, but that Style option is by default turned off.
Phát hành các Ghi chú
“Comprehensive ATH/ATL Tracker” is a Pine Script indicator designed to track and display the All-Time High (ATH) and All-Time Low (ATL) prices of a security, along with their respective dates. Additionally, it provides the highest and lowest prices for the current year (Year-To-Date, YTD). This script is particularly useful for traders and analysts who want to keep an eye on significant price levels and their historical context.

Functionality:

- All-Time High/Low Tracking: The script calculates and displays the highest and lowest prices ever recorded for the security.
- Yearly High/Low Tracking: It also tracks the highest and lowest prices for the current year.
- Delta Calculation: The script calculates the percentage difference (delta) between the current price and the ATH/ATL prices.
- Visual Representation: Users can choose to display these levels on the chart and in a table format for easy reference.

How It Works:

1. Inputs: The script allows users to toggle the display of ATH, ATL, and a statistics table.
2. Functions:
- get_all_time_high() and get_all_time_low() functions iterate through historical data to find the ATH and ATL.
- get_yearly_high(year) and get_yearly_low(year) functions find the highest and lowest prices for a specified year.
3. Data Request: The script uses request.security() to fetch ATH, ATL, and YTD high/low data.
4. Delta Calculation: It calculates the delta values as the percentage difference between the ATH/ATL prices and the current closing price.
5. Plotting:
- If enabled, the script plots horizontal lines at the ATH and ATL levels.
- It creates a table at the bottom-right of the chart displaying the ATH, ATL, YTD high, and YTD low prices, their dates, and the delta values.

Usage Instructions:

1. Add the Indicator: Apply the “Comprehensive ATH/ATL Tracker” indicator to your TradingView chart.
2. Configure Settings: Use the input options to toggle the display of ATH, ATL, and the statistics table.
3. Interpret the Data:
- The horizontal lines (if enabled) will show the ATH and ATL levels directly on the chart.
- The table will provide a detailed view of these levels, including their dates and the percentage difference from the current price.

Concepts Underlying the Calculations:
- All-Time High/Low: These are the highest and lowest prices ever recorded for the security, providing key levels of historical significance.
- Year-To-Date High/Low: These levels help traders understand the security’s performance within the current year.
- Delta: The percentage difference between the current price and the ATH/ATL levels, offering insight into how far the price has moved from these significant levels.

This script is a powerful tool for traders who want to keep track of critical price levels and their historical context, aiding in making informed trading decisions.
GrowthPortfolio managementValue

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm