Resistance card
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © UsmanQ

//@version=5
indicator("Resistance card" , overlay = true)




biastgf = input.string("High", title="Direction", options= ["High","Low"], tooltip="Select Direction from where to claculate") 
bias = biastgf == "High" ? "+" : biastgf == "Low" ? "-" :  na



Price = input.float(0, title= "1st Pivot")
Price1 = input.float(0, title= "2nd Pivot")
Price2 = input.float(0, title= "3rd Pivot")
Price3 = input.float(0, title= "4th Pivot")





//  bias == "-" ? expr2 : expr3


hline(Price, color = color.black , linewidth = 2, linestyle =hline.style_solid)

// first pivot levels
hline(bias == "-" ? Price + (Price*0.5): Price - (Price*0.5), linestyle =hline.style_solid,title ="50%", color = color.red , linewidth = 2)
hline(bias == "-" ? Price + (Price*0.75): Price - (Price*0.75) , linestyle =hline.style_dashed, title ="75%",color = color.red , linewidth = 2)
hline(bias == "-" ? Price + (Price*1): Price - (Price*1), linestyle =hline.style_solid, title ="100%",color = color.red , linewidth = 3)
hline(bias == "-" ? Price + (Price*2): Price - (Price*2), linestyle =hline.style_solid,title ="200%",color = color.red , linewidth = 2)
hline(bias == "-" ? Price + (Price*3): Price - (Price*3), linestyle =hline.style_solid, title ="300%",color = color.red , linewidth = 2)
hline(bias == "-" ? Price + (Price*4): Price - (Price*4), linestyle =hline.style_solid, title ="400%",color = color.red , linewidth = 2)

//2nd pivot levels
hline(bias == "-" ? Price1 + (Price1*0.25): Price1 - (Price1*0.25)  , linestyle =hline.style_dashed,title ="Pivot 2 - 25%")
hline(bias == "-" ? Price1 + (Price1*0.5): Price1 - (Price1*0.5), linestyle =hline.style_solid,title ="Pivot 2 - 50%", color = color.red , linewidth = 2)
hline(bias == "-" ? Price1 + (Price1*0.75): Price1 - (Price1*0.75) , linestyle =hline.style_dashed, title ="Pivot 2 - 75%",color = color.red , linewidth = 2)
hline(bias == "-" ? Price1 + (Price1*1): Price1 - (Price1*1), linestyle =hline.style_solid, title ="Pivot 2 - 100%",color = color.red , linewidth = 3)
// hline(bias == "-" ? Price1 + (Price1*2): Price1 - (Price1*2), linestyle =hline.style_solid,title ="Pivot 2 - 200%",color = color.red , linewidth = 2)
// hline(bias == "-" ? Price1 + (Price1*3): Price1 - (Price1*3), linestyle =hline.style_solid, title ="Pivot 2 - 300%",color = color.red , linewidth = 2)
// hline(bias == "-" ? Price1 + (Price1*4): Price1 - (Price1*4), linestyle =hline.style_solid, title ="Pivot 2 - 400%",color = color.red , linewidth = 2)

//3rd pivot levels
hline(bias == "-" ? Price2 + (Price2*0.25): Price2 - (Price2*0.25)  , linestyle =hline.style_dashed,title ="Pivot 3 - 25%")
hline(bias == "-" ? Price2 + (Price2*0.5): Price2 - (Price2*0.5), linestyle =hline.style_solid,title ="Pivot 3 - 50%", color = color.red , linewidth = 2)
hline(bias == "-" ? Price2 + (Price2*0.75): Price2 - (Price2*0.75) , linestyle =hline.style_dashed, title ="Pivot 3 - 75%",color = color.red , linewidth = 2)
hline(bias == "-" ? Price2 + (Price2*1): Price2 - (Price2*1), linestyle =hline.style_solid, title ="Pivot 3 - 100%",color = color.red , linewidth = 3)
// hline(bias == "-" ? Price2 + (Price2*2): Price2 - (Price2*2), linestyle =hline.style_solid,title ="Pivot 3 - 200%",color = color.red , linewidth = 2)
// hline(bias == "-" ? Price2 + (Price2*3): Price2 - (Price2*3), linestyle =hline.style_solid, title ="Pivot 3 - 300%",color = color.red , linewidth = 2)
// hline(bias == "-" ? Price2 + (Price2*4): Price2 - (Price2*4), linestyle =hline.style_solid, title ="Pivot 3 - 400%",color = color.red , linewidth = 2)

//4th pivot levels
hline(bias == "-" ? Price3 + (Price3*0.25): Price3 - (Price3*0.25)  , linestyle =hline.style_dashed,title ="Pivot 4 - 25%")
hline(bias == "-" ? Price3 + (Price3*0.5): Price3 - (Price3*0.5), linestyle =hline.style_solid,title ="Pivot 4 - 50%", color = color.red , linewidth = 2)
hline(bias == "-" ? Price3 + (Price3*0.75): Price3 - (Price3*0.75) , linestyle =hline.style_dashed, title ="Pivot 4 - 75%",color = color.red , linewidth = 2)
hline(bias == "-" ? Price3 + (Price3*1): Price3 - (Price3*1), linestyle =hline.style_solid, title ="Pivot 4 - 100%",color = color.red , linewidth = 2)
// hline(bias == "-" ? Price3 + (Price3*2): Price3 - (Price3*2), linestyle =hline.style_solid,title ="200%",color = color.red , linewidth = 2)
// hline(bias == "-" ? Price3 + (Price3*3): Price3 - (Price3*3), linestyle =hline.style_solid, title ="300%",color = color.red , linewidth = 2)
// hline(bias == "-" ? Price3 + (Price3*4): Price3 - (Price3*4), linestyle =hline.style_solid, title ="400%",color = color.red , linewidth = 2)





//sub divions of 1st pivot

hline(bias == "-" ? Price + (Price*0.125): Price - (Price*0.125) , linestyle =hline.style_dashed,title ="12.5%")
hline(bias == "-" ? Price + (Price*0.25): Price - (Price*0.25)  , linestyle =hline.style_dashed,title ="25%")
hline(bias == "-" ? Price + (Price*0.333): Price - (Price*0.333)  , linestyle =hline.style_dashed,title ="33%")
hline(bias == "-" ? Price + (Price*0.375): Price - (Price*0.375)  , linestyle =hline.style_dashed,title ="37.5")
hline(bias == "-" ? Price + (Price*1.25): Price - (Price*1.25), linestyle =hline.style_dashed,title ="125%")
hline(bias == "-" ? Price + (Price*1.5): Price - (Price*1.5), linestyle =hline.style_dashed,title ="150%")
hline(bias == "-" ? Price + (Price*1.75): Price - (Price*1.75), linestyle =hline.style_dashed,title ="175%")
hline(bias == "-" ? Price + (Price*2.25): Price - (Price*2.25), linestyle =hline.style_dashed,title ="225%")
hline(bias == "-" ? Price + (Price*2.5): Price - (Price*2.5), linestyle =hline.style_dashed,title ="250%")
hline(bias == "-" ? Price + (Price*2.75): Price - (Price*2.75), linestyle =hline.style_dashed,title ="275%")
hline(bias == "-" ? Price + (Price*3.25): Price - (Price*3.25), linestyle =hline.style_dashed,title ="325%")
hline(bias == "-" ? Price + (Price*3.5): Price - (Price*3.5), linestyle =hline.style_dashed,title ="350%")
hline(bias == "-" ? Price + (Price*3.75): Price - (Price*3.75), linestyle =hline.style_dashed,title ="375%")
hline(bias == "-" ? Price + (Price*4): Price - (Price*4), linestyle =hline.style_dashed,title ="400%")


















plot(close ,transp = 100)
