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

//@version=5
indicator(title="StopLoss",shorttitle="SL+", overlay=true)
//hiding and showing lines

str=input.string("Low Risk",title="Multiplier",options=["Risk Lover","High Risk","Low Risk","Don't Risk"])
mult=str == "Don't Risk" ? 2.2 : str == "Low Risk" ? 1.7 : str == "High Risk" ? 1.3 : str == "Risk Lover" ? 0.9 : na
src=close
lenght=input(14,"Lenght")
atr=ta.atr(lenght)//getting atr values
ratio=atr/close*100*mult+40000
//getting maximum percentage of losing
longstoploss_level=open-atr*(mult)//determining the levels
shortstoploss_level=open+atr*(mult)// //manupilating mult by try and fail method
plot(ratio,display=display.none,color=color.lime)//plotting ratio
plot(longstoploss_level,title="Long StopLoss",linewidth=2,color=color.red,linewidth=1,style=plot.style_circles)//plotting long sl
plot(shortstoploss_level,title="Short StopLoss",linewidth=2,color=color.green,linewidth=1,style=plot.style_circles)//plotting short sl
bcolor= if high > shortstoploss_level or low < longstoploss_level
    color.yellow
barcolor(bcolor,title="Fail Bars")
