Risk assistant - A simple risk caluclator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Ziloan

//@version=5
indicator("Risk assistant",overlay=true)

grp1 = "General settings"
p_size = input(10000,"Portfolio size",group=grp1)
risk = input.float(0.5,title="Portfolio percentage risked per trade",step=0.1,group=grp1,minval=0)
risk_size = p_size/100*risk

grp2 = "User input"
risk_measured = input.float(0,title="Measured risk in USD",tooltip="Or whatatever Portfolio size's denominator is",step=1,minval=0,group=grp2)
risk_usd = risk_size/risk_measured

var label lbl = na
label.delete(lbl)
if barstate.islast
    lbl := label.new(bar_index+10,close+close*0.005,str.tostring(risk_usd))
