OPEN-SOURCE SCRIPT
Aggregate PDH High Break Alert

**Aggregate PDH High Break Alert**
**Overview**
The “Aggregate PDH High Break Alert” is a lightweight Pine Script v6 indicator designed to instantly notify you when today’s price breaks above any prior-day high in a user-defined lookback window. Instead of manually scanning dozens of daily highs, this script automatically loops through the last _N_ days (up to 100) and fires a single-bar alert the moment price eclipses a specific day’s high.
**Key Features**
- **Dynamic Lookback**: Choose any lookback period from 1 to 100 days via a single `High-Break Lookback` input.
- **Single Security Call**: Efficiently retrieves the entire daily-high series in one call to avoid TradingView’s 40-call security limit.
- **Automatic Looping**: Internally loops through each prior-day high, so there’s no need to manually code dozens of lines.
- **Custom Alerts**: Generates a clear, formatted alert message—e.g. “Crossed high from 7 day(s) ago”—for each breakout.
- **Lightweight & Maintainable**: Compact codebase (<15 lines) makes tweaking and debugging a breeze.
**Inputs**
- **High-Break Lookback (days)**: Number of past days to monitor for high breaks. Valid range: 1–100.
**How to Use**
1. **Add to Chart**: Open TradingView, click “Indicators,” then “Create,” and paste in the code.
2. **Configure Lookback**: In the script’s settings, set your desired lookback window (e.g., 20 for the past 20 days).
3. **Enable Alerts**: Right-click the indicator’s name on your chart, select “Add Alert on Aggregate PDH High Break Alert,” and choose “Once per bar close.”
4. **Receive Notifications**: Whenever price crosses above any of the specified prior-day highs, you’ll get an on-screen and/or mobile push alert with the exact number of days ago.
**Use Cases**
- **Trend Confirmation**: Confirm fresh bullish momentum when today’s high outpaces any of the last _N_ days.
- **Breakout Trading**: Automate entries off multi-day highs without manual chart scanning.
- **System Integration**: Integrate with alerts to trigger orders in third-party bots or webhook receivers.
**Disclaimer**
Breakouts alone do not guarantee sustained moves. Combine with your preferred risk management, volume filters, and other indicators for higher-probability setups. Use on markets and timeframes where daily breakout behavior aligns with your strategy.
**Overview**
The “Aggregate PDH High Break Alert” is a lightweight Pine Script v6 indicator designed to instantly notify you when today’s price breaks above any prior-day high in a user-defined lookback window. Instead of manually scanning dozens of daily highs, this script automatically loops through the last _N_ days (up to 100) and fires a single-bar alert the moment price eclipses a specific day’s high.
**Key Features**
- **Dynamic Lookback**: Choose any lookback period from 1 to 100 days via a single `High-Break Lookback` input.
- **Single Security Call**: Efficiently retrieves the entire daily-high series in one call to avoid TradingView’s 40-call security limit.
- **Automatic Looping**: Internally loops through each prior-day high, so there’s no need to manually code dozens of lines.
- **Custom Alerts**: Generates a clear, formatted alert message—e.g. “Crossed high from 7 day(s) ago”—for each breakout.
- **Lightweight & Maintainable**: Compact codebase (<15 lines) makes tweaking and debugging a breeze.
**Inputs**
- **High-Break Lookback (days)**: Number of past days to monitor for high breaks. Valid range: 1–100.
**How to Use**
1. **Add to Chart**: Open TradingView, click “Indicators,” then “Create,” and paste in the code.
2. **Configure Lookback**: In the script’s settings, set your desired lookback window (e.g., 20 for the past 20 days).
3. **Enable Alerts**: Right-click the indicator’s name on your chart, select “Add Alert on Aggregate PDH High Break Alert,” and choose “Once per bar close.”
4. **Receive Notifications**: Whenever price crosses above any of the specified prior-day highs, you’ll get an on-screen and/or mobile push alert with the exact number of days ago.
**Use Cases**
- **Trend Confirmation**: Confirm fresh bullish momentum when today’s high outpaces any of the last _N_ days.
- **Breakout Trading**: Automate entries off multi-day highs without manual chart scanning.
- **System Integration**: Integrate with alerts to trigger orders in third-party bots or webhook receivers.
**Disclaimer**
Breakouts alone do not guarantee sustained moves. Combine with your preferred risk management, volume filters, and other indicators for higher-probability setups. Use on markets and timeframes where daily breakout behavior aligns with your strategy.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
For quick access on a chart, add this script to your favorites — learn more here.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.