Sidechair

currency.* constants

Browse the reference

Currency codes such as currency.USD, currency.EUR and currency.BTC, for strategy() and request.* currency arguments, plus currency.NONE.

Try it in the editor

currency.* constants are strings holding the ISO code, such as "USD" for currency.USD. They go in the currency argument of strategy(), request.security and the other request.* functions, where the result is converted to that currency at the exchange rate of each bar. They also compare against syminfo.currency, the quote currency of the chart's symbol, and syminfo.basecurrency.

currency.NONE means no currency. Pass it to leave a request unconverted, for values that are not money, such as a ratio.

Constants

NameValueDescription
currency.NONENo currency; leaves a currency setting unset.
currency.AEDAEDUAE dirham
currency.ARSARSArgentine peso
currency.AUDAUDAustralian dollar
currency.BDTBDTBangladeshi taka
currency.BHDBHDBahraini dinar
currency.BRLBRLBrazilian real
currency.BTCBTCBitcoin
currency.CADCADCanadian dollar
currency.CHFCHFSwiss franc
currency.CLPCLPChilean peso
currency.CNYCNYChinese yuan
currency.COPCOPColombian peso
currency.CZKCZKCzech koruna
currency.DKKDKKDanish krone
currency.EGPEGPEgyptian pound
currency.ETHETHEther
currency.EUREUREuro
currency.GBPGBPBritish pound
currency.HKDHKDHong Kong dollar
currency.HUFHUFHungarian forint
currency.IDRIDRIndonesian rupiah
currency.ILSILSIsraeli shekel
currency.INRINRIndian rupee
currency.ISKISKIcelandic krona
currency.JPYJPYJapanese yen
currency.KESKESKenyan shilling
currency.KRWKRWSouth Korean won
currency.KWDKWDKuwaiti dinar
currency.LKRLKRSri Lankan rupee
currency.MADMADMoroccan dirham
currency.MXNMXNMexican peso
currency.MYRMYRMalaysian ringgit
currency.NGNNGNNigerian naira
currency.NOKNOKNorwegian krone
currency.NZDNZDNew Zealand dollar
currency.PENPENPeruvian sol
currency.PHPPHPPhilippine peso
currency.PKRPKRPakistani rupee
currency.PLNPLNPolish zloty
currency.QARQARQatari riyal
currency.RONRONRomanian leu
currency.RSDRSDSerbian dinar
currency.RUBRUBRussian ruble
currency.SARSARSaudi riyal
currency.SEKSEKSwedish krona
currency.SGDSGDSingapore dollar
currency.THBTHBThai baht
currency.TNDTNDTunisian dinar
currency.TRYTRYTurkish lira
currency.TWDTWDNew Taiwan dollar
currency.USDUSDUS dollar
currency.USDTUSDTTether
currency.VESVESVenezuelan bolivar
currency.VNDVNDVietnamese dong
currency.ZARZARSouth African rand

Remarks

  • Conversion uses the rate at the time of each bar, not today's rate.
  • Crypto codes such as currency.BTC, currency.ETH and currency.USDT convert to a coin, which is useful for pricing a stock in bitcoin.

Example

Pine ScriptCheck the quote currencyOpen in editor
//@version=6
strategy("Currency", overlay = true, currency = currency.USD)
inUsd = syminfo.currency == currency.USD
bgcolor(inUsd ? na : color.new(color.orange, 85))
plot(close, "Close", color.gray)
if barstate.islast
    label.new(bar_index, high, "Quote currency: " + syminfo.currency)

See also

Runs on Sidechair