// Swing High and Swing Low Logic isSwingHigh = high == ta.highest(high, swingLength) isSwingLow = low == ta.lowest(low, swingLength)
// Plot Support and Resistance Levels for Current Timeframe var line resistanceLine = na // Variable for storing resistance line var line supportLine = na // Variable for storing support line
// Draw Resistance Line (Current Timeframe) if isSwingHigh and isHammer if not na(resistanceLine) line.delete(resistanceLine) // Delete previous line resistanceLine := line.new(bar_index, high, bar_index + 10, high, color=color.red, width=1, extend=extend.right)
// Draw Support Line (Current Timeframe) if isSwingLow and isHangingMan if not na(supportLine) line.delete(supportLine) // Delete previous line supportLine := line.new(bar_index, low, bar_index + 10, low, color=color.green, width=1, extend=extend.right)
// Resistance and Support for Daily Timeframe daily_high = request.security(syminfo.tickerid, "D", high) daily_low = request.security(syminfo.tickerid, "D", low)
// Resistance and Support for Weekly Timeframe weekly_high = request.security(syminfo.tickerid, "W", high) weekly_low = request.security(syminfo.tickerid, "W", low)
// Resistance and Support for Monthly Timeframe monthly_high = request.security(syminfo.tickerid, "M", high) monthly_low = request.security(syminfo.tickerid, "M", low)
// Plot Resistance and Support for Daily, Weekly, and Monthly Timeframes plot(daily_high, color=color.red, linewidth=1, title="Daily Resistance", style=plot.style_line) plot(daily_low, color=color.green, linewidth=1, title="Daily Support", style=plot.style_line)