The script helps traders: • Visualize the high and low levels for the previous daily, weekly, and monthly periods. • Receive alerts when the current price crosses these levels. • Identify key support and resistance zones based on historical highs and lows.
2. Key Features
User Inputs
The script offers customization options through input parameters: • Daily Levels: • Enable/disable displaying daily levels (Show Daily Levels). • Customize the color for daily level lines (Daily Line Color). • Weekly Levels: • Enable/disable displaying weekly levels (Show Weekly Levels). • Customize the color for weekly level lines (Weekly Line Color). • Monthly Levels: • Enable/disable displaying monthly levels (Show Monthly Levels). • Customize the color for monthly level lines (Monthly Line Color).
3. Core Functionality
Level Calculations
The script retrieves the previous daily, weekly, and monthly highs and lows using the request.security() function: • Daily High/Low: Taken from the previous day’s high and low. • Weekly High/Low: Taken from the previous week’s high and low. • Monthly High/Low: Taken from the previous month’s high and low.
Price Crossing Detection
For each level (daily, weekly, monthly), the script checks if the current high or low price has crossed: • The previous high (triggering a “High Reached” alert). • The previous low (triggering a “Low Reached” alert).
4. Visual Features
The script plots lines to represent the previous highs and lows: • Daily Levels: • Dashed lines for the previous daily high and low. • Configurable color (Daily Line Color). • Weekly Levels: • Dashed lines for the previous weekly high and low. • Configurable color (Weekly Line Color). • Monthly Levels: • Dashed lines for the previous monthly high and low. • Configurable color (Monthly Line Color).
These lines extend forward by one bar for better visibility on the chart.
5. Alert Features
The script provides alerts for when the price crosses these levels: • Daily Alerts: • “Daily High Reached” when the current price crosses the previous daily high. • “Daily Low Reached” when the current price crosses the previous daily low. • Weekly Alerts: • “Weekly High Reached” when the current price crosses the previous weekly high. • “Weekly Low Reached” when the current price crosses the previous weekly low. • Monthly Alerts: • “Monthly High Reached” when the current price crosses the previous monthly high. • “Monthly Low Reached” when the current price crosses the previous monthly low.
6. Practical Use Case
This script is ideal for traders who: • Use support and resistance levels from daily, weekly, and monthly timeframes as part of their strategy. • Want to monitor price interactions with these levels in real-time. • Need automatic alerts for key price movements without continuously monitoring the chart.
7. Limitations • Max Line Count: TradingView limits the number of lines that can be drawn on the chart to max_lines_count = 500. • No Historical Levels: The script only tracks the most recent daily, weekly, and monthly levels and does not display historical levels.https://www.tradingview.com/x/VFzvYyTF/