Stop Loss and Take Profit calculations
study(title="Money Management", overlay=false) equity=input(title="Equity", type=float, defval=3000, minval=2000) risk=input(title="Risk per trade", type=float, defval=0.02, minval=0.01, maxval=0.99) mainTF=period=="W"?"M":period=="D"?"W":period=="240"?"D":period=="60"?"D":period=="45"?"W":period=="30"?"240":period=="15"?"60":period=="10"?"60":period=="5"?"30":period=="3"?"15":period=="2"?"10":period=="1"?"5":"" trueRange0=max(abs(high - close[1]), abs(low - close[1])) trueRange=max((high - low), trueRange0) atr=ema(trueRange,24) Satr=security(tickerid, mainTF, atr) plotchar(close-2*Satr, color=red) plotchar(close-Satr, color=red) plotchar(close+Satr, color=green) plotchar(close+2*Satr, color=green) plotchar(equity*risk/Satr, color=green)