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

//@version=5
indicator(shorttitle="Value", title="Worth of value")

float Amount = input.float(title="Quantity", defval=0.0)
float Paid = input.float(title="Paid", defval=0.0)
float Percent = input.float(title="Percent (inc. btw)", defval=0.0)

Kost = Amount - 1*(Amount * Percent / 100)


float c = close * Kost //50 
plotColor = if c > Paid
    color.green
else
    color.red

var label LL = label.new(na, na, "€")
label.set_xy(LL, bar_index, c)
label.set_text(LL, "€" + str.tostring(c, format.mintick))
label.set_textcolor(LL, textcolor=color.white)

plot(c, color=plotColor)

var line2 = line.new(time, open, time + 60 * 60 * 24, close, xloc=xloc.bar_time, style=line.style_dashed)
line.set_width(line2, 5)


