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

//@version=5
indicator("Profit Monitor","",true)
currentvalue = close
quantity = input(title="Quatity", defval=1.0)
bvalue = input(title="Entry price", defval=1.0)
usdtvalue = request.security("FX_IDC:USDINR", "1", currentvalue)

profitOrLoss = (currentvalue - bvalue)*quantity*usdtvalue
percent = ((currentvalue - bvalue)/bvalue)*100
printTable(txt) => var table t = table.new(position.middle_right, 1, 1), table.cell(t, 0, 0, txt, bgcolor = color.yellow,text_halign=text.align_left)
printTable("Invested: "+str.tostring(bvalue*usdtvalue*quantity)+"\On Sell : "+str.tostring(currentvalue*usdtvalue*quantity)+"\nProfit n Loss\n" + str.tostring(profitOrLoss) + "\n"+str.tostring(percent)+"%")
//plot(close)
