//version=5 indicator("Support and Resistance (1 Hour)", overlay=true)
// Define the period for support and resistance (in this case, 50 bars) length = input.int(50, title="Lookback Period", minval=1)
// Calculate the highest high and lowest low over the lookback period highestHigh = ta.highest(high, length) lowestLow = ta.lowest(low, length)
// Plot the support and resistance lines on the chart plot(highestHigh, title="Resistance", color=color.red, linewidth=2) plot(lowestLow, title="Support", color=color.green, linewidth=2)
// Add background shading to highlight areas near support and resistance bgcolor(close >= highestHigh ? color.new(color.red, 90) : na) bgcolor(close <= lowestLow ? color.new(color.green, 90) : na)
// Display the values of the support and resistance levels plotchar(highestHigh, title="Resistance Value", location=location.top, color=color.red, offset=-1) plotchar(lowestLow, title="Support Value", location=location.bottom, color=color.green, offset=-1)