In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
//@version=2 study(title='[RS]Gold to Custom Currency V0', shorttitle='G', overlay=false) grams_in_troy_ounces = 31.103 currency = input(title='Dollar Vs Currency desired to list gold:', type=string, defval='FX_IDC:USDINR', confirm=false) gold_in_dollars = security('FX_IDC:XAUUSD', period, close) dollars_in_currency = security(currency, period, close) gold_oz_in_currency = gold_in_dollars * dollars_in_currency gold_gm_in_currency = gold_oz_in_currency / grams_in_troy_ounces plot(title='Oz', series=gold_oz_in_currency, color=black, transp=0, trackprice=true) plot(title='Gm', series=gold_gm_in_currency, color=teal, transp=0, trackprice=true)