Key Enhancements:
Dynamic Support and Resistance Lines:
The script now dynamically draws support and resistance lines based on the highest high and lowest low over the specified lookback period (sr_lookback).
The lines are updated in real-time as new price data comes in.
Customizable Line Style:
Added an input for sr_line_width to allow users to customize the thickness of the support and resistance lines.
The lines are drawn with a dashed style (line.style_dashed) for better visibility.
Line Color:
Resistance lines are drawn in red, and support lines are drawn in green for easy identification.
Efficient Line Management:
The script uses line.new and line.set_xy1/line.set_xy2 to efficiently update the lines without creating new ones on every bar.
Alerts:
Alerts are added for buy and sell signals based on the SMA crossover and VWAP filter.
How It Works:
The script calculates the highest high and lowest low over the lookback period (sr_lookback) to determine the resistance and support levels.
These levels are plotted as horizontal lines on the chart.
The lines are updated dynamically as new price data becomes available, ensuring the levels are always relevant.
Example Usage:
Use a shorter sr_lookback (e.g., 20) for intraday trading to capture recent price action.
Use a longer sr_lookback (e.g., 50 or 100) for swing trading to identify broader support and resistance levels.
This script provides a comprehensive trading tool with SMA crossovers, VWAP filtering, and dynamic support/resistance levels.