OPEN-SOURCE SCRIPT
已更新

Key Levels with Alerts

785

Introducing the "Key Levels with Alerts" Indicator

This powerful and fully customizable indicator for the TradingView platform helps you easily identify and monitor crucial **daily, weekly, and monthly price levels** directly on your chart. Beyond just visual representation, the indicator offers advanced alert capabilities to notify you of any price breaks at these significant areas.


Key Levels Identified by the Indicator

This indicator calculates and displays six vital price levels based on the previous day's, week's, and month's closed candles:

1. **PDH (Previous Day High):** The highest price of the previous day.
2. **PDL (Previous Day Low):** The lowest price of the previous day.
3. **PWH (Previous Week High):** The highest price of the previous week.
4. **PWL (Previous Week Low):** The lowest price of the previous week.
5. **PMH (Previous Month High):** The highest price of the previous month.
6. **PML (Previous Month Low):** The lowest price of the previous month.


Core Features


* **Visual Line Display:** Each of these six levels is plotted as a **horizontal line** on your chart. These lines start from the current candle and extend forward for a specified number of candles (defaulting to 20 candles).
* **Complete Style Customization:** For every level (PDH, PDL, PWH, PWL, PMH, PML), you can **independently customize** the line's color, width, and style (solid, dashed, dotted) directly through the indicator's settings. This feature allows you to easily differentiate between the various levels.
* **Toggleable Labels:** You can choose whether to display text labels like "PDH", "PDL", "PWH", "PWL", "PMH", "PML" at the end of each line. The style of these labels will also automatically match their corresponding line colors.
* **Line Visibility Control:** Beyond just labels, you can also independently **show or hide the lines themselves** for PDH, PDL, PWH, PWL, PMH, and PML.
* **Price Break Alerts:** This is one of the indicator's most important features. You can set up alerts for each of these levels:
* **PDH Break Alert:** Triggers when the price moves above the **Previous Day High**.
* **PDL Break Alert:** Triggers when the price moves below the **Previous Day Low**.
* **PWH Break Alert:** Triggers when the price moves above the **Previous Week High**.
* **PWL Break Alert:** Triggers when the price moves below the **Previous Week Low**.
* **PMH Break Alert:** Triggers when the price moves above the **Previous Month High**.
* **PML Break Alert:** Triggers when the price moves below the **Previous Month Low**.
* **Clear Alert Messages:** Each alert message includes the **symbol or ticker name** (e.g., `[EURUSD]`) so you can quickly identify which asset the alert pertains to and which level has been broken.
* **Enable/Disable Alerts:** You have the flexibility to enable or disable each PDH, PDL, PWH, PWL, PMH, and PML alert independently via the indicator's settings.


Why This Indicator Is Useful

Daily, weekly, and monthly High and Low levels often act as **key support and resistance areas**. Traders use these levels to identify potential entry and exit points, set stop-loss and take-profit targets, and understand overall market sentiment. This indicator, with its clear visualization and timely alerts, helps you effectively leverage this crucial information in your trading strategies.
發行說明
Update chart view
發行說明
Release Notes:

- Added Daily, Weekly, and Monthly Key Levels: Implemented the display of previous day's high/low (PDH/PDL), previous week's high/low (PWH/PWL), and previous month's high/low (PMH/PML) to highlight significant price levels from past periods.

- Optimized Line Lengths for Improved Readability: Introduced configurable line lengths for daily, weekly, and monthly levels, allowing users to adjust the visual extent of each key level for better chart clarity and readability.
- pdLineLength: Sets the length for Previous Day High/Low lines.
- pwLineLength: Sets the length for Previous Week High/Low lines.
- pmLineLength: Sets the length for Previous Month High/Low lines.
- dayLineLength: Sets the length for Current Day High/Low lines.
- weekLineLength: Sets the length for Current Week High/Low lines.
- monthLineLength: Sets the length for Current Month High/Low lines.

- Improved Code Performance: Refactored line and label management functions (f_createOrDeleteLine, f_createOrDeleteLabel) to efficiently update existing drawing objects. This enhancement reduces redundant object creation and deletion, contributing to smoother indicator performance on the chart.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。