// Highlight zones if the price is within them bgcolor(highlightZones and resistanceLevel and close >= resistanceZoneBottom and close <= resistanceZoneTop ? color.new(color.red, 85) : na, title="Resistance Zone") bgcolor(highlightZones and supportLevel and close >= supportZoneBottom and close <= supportZoneTop ? color.new(color.green, 85) : na, title="Support Zone")
// Plot support and resistance levels plot(resistanceLevel, title="Resistance", color=color.red, linewidth=2, style=plot.style_line) plot(supportLevel, title="Support", color=color.green, linewidth=2, style=plot.style_line)
// Alerts for when price enters the zones alertcondition(close >= resistanceZoneBottom and close <= resistanceZoneTop, title="Resistance Zone Alert", message="Price entered Resistance Zone") alertcondition(close >= supportZoneBottom and close <= supportZoneTop, title="Support Zone Alert", message="Price entered Support Zone")