I completed the code for support & resistance. I added additional conditions for the previous quarter and month high and low. It plots pretty good now, but in some occasions it does not plot a resistance that should be there, and I cannot figure out why that is.

The green arrows represent support, and red arrows are resistance. At the 2 peaks to ther right, resistance red arrows should be plotted, because the price crossed under the previous quarter and month low, and then crossedup above the previous week high, while staying under the previous quarter and month high, but nothing is plotted.
//@version=4
//By Juros
// Resistance is not plotted 100% accurate, some are missing.
//-------------------------------
// support
// If the price crosses above the previous quarter high and previous month high, and then crosses down the previous week low, the close becomes a support.
//As long as the price stays then below the previous week high, each close becomes a support. The condition remains as long as the prices do not cross
//below previous quarter low OR previous month low, then support also stops.
//-------------------------------
// resistance
// If the price crosses below the previous quarter low and previous month low, and then crosses up the previous week high, the close becomes a resistance.
// As long as the price stays then above the previous week low, each close becomes a support. The condition remains as long as the price does not cross
// above previous quarter high OR previous month high, then resistance also stops.
study(title="Universal support and resistance", shorttitle="Univ sup & res", overlay=true, precision=8)
prevwkH = input(true, title="Show previous week high")
prevwkL = input(true, title="show previous week low?")
prevMH = input(true, title= "Show previous month high")
prevML = input(true, title= "Show previous month low")
prevQH = input(true, title= "Show previous quarter high")
prevQL = input(true, title= "Show previous quarter low")
//previous week high and low
prevWeekHigh = security(syminfo.tickerid, 'W', high[1], lookahead=true)
prevWeekLow = security(syminfo.tickerid, 'W', low[1], lookahead=true)
//previous Week Plots
plot(prevwkH and prevWeekHigh ? prevWeekHigh : na, title="Prev Week High", style=plot.style_stepline, linewidth=1, color=color.fuchsia,transp=20)
plot(prevwkL and prevWeekLow ? prevWeekLow : na, title="Prev Week Low", style=plot.style_stepline, linewidth=1, color=color.fuchsia,transp=20)
//-------------------------------------------------------
// Previous month high and low
prevMonthHigh = security(syminfo.tickerid, 'M', high[1], lookahead=true)
prevMonthLow = security(syminfo.tickerid, 'M', low[1], lookahead=true)
plot(prevMH and prevMonthHigh ? prevMonthHigh : na, title="Prev Month High", style=plot.style_stepline, linewidth=1, color=color.orange, transp=40)
plot(prevML and prevMonthLow ? prevMonthLow : na, title="Prev Month Low", style=plot.style_stepline, linewidth=1, color=color.orange, transp=40)
//-------------------------------------------------------------
//Previous quarter high and low
prevQuarterHigh = security(syminfo.tickerid, '3M', high[1], lookahead=true)
prevQuarterLow = security(syminfo.tickerid, '3M', low[1], lookahead=true)
plot(prevQH and prevQuarterHigh ? prevQuarterHigh : na, title="Prev Quarter High", style=plot.style_stepline, linewidth=1, color=color.aqua, transp=0)
plot(prevQL and prevQuarterLow ? prevQuarterLow : na, title="Prev Quarter Low", style=plot.style_stepline, linewidth=1, color=color.aqua, transp=0)
//-------------------------------------------------------------
upTrend = false
upTrend := (not upTrend[1] and crossover(close, prevQuarterHigh)) or (upTrend[1] and not crossunder(low, prevQuarterLow) or (not upTrend[1] and crossover(high, prevMonthHigh)) or upTrend[1] and not crossunder(low, prevMonthLow))
//-------------------------------------------------------------
// weekly support and resistance
var isSupport = false
var isResistance = false
if (crossunder(low, prevWeekLow))
isSupport := true
isResistance := false
if (crossover(high, prevWeekHigh))
isSupport := false
isResistance := true
//-------------------------------------------------------------
// Monthly support
var isSupportM = false
if (crossunder(low, prevMonthLow))
isSupportM := false
if (crossover(high, prevMonthHigh))
isSupportM := true
//-------------------------------------------------------------
// Quarterly support
var isSupportQ = false
if (crossunder(low, prevQuarterLow))
isSupportQ := false
if (crossover(high, prevQuarterHigh))
isSupportQ := true
//-------------------------------------------------------------
// Monthly resistance
var isResistanceM = false
if (crossunder(low, prevMonthLow))
isResistanceM := true
if (crossover(high, prevMonthHigh))
isResistanceM := false
//-------------------------------------------------------------
// Quarterly resistance
var isResistanceQ = false
if (crossunder(low, prevQuarterLow))
isResistanceQ := true
if (crossover(high, prevQuarterHigh))
isResistanceQ := false
//plot support & resistance
plotshape (upTrend and isSupport and isSupportM and isSupportQ ? close: na, style=shape.arrowup, location=location.belowbar, color=color.green, size=size.normal, transp=0 )
plotshape (not upTrend and isResistance and isResistanceM and isResistanceQ ? close: na, style=shape.arrowdown, location=location.abovebar, color=color.red, size= size.normal, transp=0 )
