OPEN-SOURCE SCRIPT
Smart Money Concepts [LuxAlgo]

//version=5
indicator("Gold Price (Korea 1 Don)", overlay=true)
// [1] 설정: 실시간 환율 데이터 가져오기 (FX_IDC:USDKRW)
usdKrw = request.security("FX_IDC:USDKRW", timeframe.period, close)
// [2] 계산 로직
// 트레이딩뷰 XAUUSD는 1트로이온스(31.1034768g) 기준
// 공식: (국제시세 * 환율 / 31.1035) * 3.75
troyOunceToGram = 31.1034768
oneDonGram = 3.75
goldPriceKrw = (close * usdKrw / troyOunceToGram) * oneDonGram
// [3] 화면 표시 (테이블 생성)
var table priceTable = table.new(position.top_right, 2, 2, bgcolor = color.new(color.black, 50), border_width = 1)
if barstate.islast
// 헤더
table.cell(priceTable, 0, 0, "한국 금시세 (1돈)", text_color = color.white, bgcolor=color.new(color.gray, 20), text_size=size.small)
// 가격 표시 (원화 형식으로 콤마 찍어서 출력)
table.cell(priceTable, 0, 1, str.format("{0,number,###,###} 원", goldPriceKrw), text_color = color.yellow, text_size=size.large, bgcolor=color.black)
// 참고용 환율 표시
table.cell(priceTable, 1, 0, "적용 환율", text_color = color.gray, text_size=size.small)
table.cell(priceTable, 1, 1, str.format("{0,number,#,###.##} 원/$", usdKrw), text_color = color.gray, text_size=size.small)
indicator("Gold Price (Korea 1 Don)", overlay=true)
// [1] 설정: 실시간 환율 데이터 가져오기 (FX_IDC:USDKRW)
usdKrw = request.security("FX_IDC:USDKRW", timeframe.period, close)
// [2] 계산 로직
// 트레이딩뷰 XAUUSD는 1트로이온스(31.1034768g) 기준
// 공식: (국제시세 * 환율 / 31.1035) * 3.75
troyOunceToGram = 31.1034768
oneDonGram = 3.75
goldPriceKrw = (close * usdKrw / troyOunceToGram) * oneDonGram
// [3] 화면 표시 (테이블 생성)
var table priceTable = table.new(position.top_right, 2, 2, bgcolor = color.new(color.black, 50), border_width = 1)
if barstate.islast
// 헤더
table.cell(priceTable, 0, 0, "한국 금시세 (1돈)", text_color = color.white, bgcolor=color.new(color.gray, 20), text_size=size.small)
// 가격 표시 (원화 형식으로 콤마 찍어서 출력)
table.cell(priceTable, 0, 1, str.format("{0,number,###,###} 원", goldPriceKrw), text_color = color.yellow, text_size=size.large, bgcolor=color.black)
// 참고용 환율 표시
table.cell(priceTable, 1, 0, "적용 환율", text_color = color.gray, text_size=size.small)
table.cell(priceTable, 1, 1, str.format("{0,number,#,###.##} 원/$", usdKrw), text_color = color.gray, text_size=size.small)
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.