DW-MTF-Close Price(1W/3D) as Support Line
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © techno_junkie
//@version=5
indicator("DW-MTF-Close Price as Support", overlay=true)

//TIMEFRAMES
//Specials
res_1 = input.timeframe(title='----  Time Frame 1 CLOSE  -----', inline="Res 1 Active", defval='3D')
res_1_yn = input(title='Active', defval=true, inline="Res 1 Active")

res_2 = input.timeframe(title='----  Time Frame 2 CLOSE  ----', defval='1W',inline="Res 2 Active")
res_2_yn = input(title='Active', defval=false, inline="Res 2 Active")

//plotting and avoid repaint
NoRepaintingSecurity(sym, tf, src) =>
    request.security(sym, tf, src[barstate.isrealtime ? 1 : 0])[barstate.isrealtime ? 0 : 1]

res_1_close = NoRepaintingSecurity(syminfo.tickerid, res_1, close)
//plot(nonRepaintingClose, "Non-repainting close", color.fuchsia, 3)
res_2_close = NoRepaintingSecurity(syminfo.tickerid, res_2, close)

plot(res_1_yn ? res_1_close : na, title='Res 1 Close', color=color.new(color.black, 0), style=plot.style_stepline)
plot(res_2_yn ? res_2_close : na, title='Res 2 Close', color=color.new(color.red, 0), style=plot.style_stepline)
