request.currency_rate() - Pine Script Function
request.currency_rate()
Section titled “request.currency_rate()”Overview
Section titled “Overview”Provides a daily rate that can be used to convert a value expressed in the from currency to another in the to currency.
Syntax
Section titled “Syntax”request.currency_rate(from, to, ignore_invalid_currency) → series floatParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| from | series string | The currency in which the value to be converted is expressed. Possible values: a three-letter string with the currency code in the ISO 4217 format (e.g. “USD”) |
| or | — | one of the built-in variables that return currency codes |
| like | — | syminfo.currency or currency.USD. |
Remarks
Section titled “Remarks”- If from and to arguments are equal, function returns 1. Please note that using this variable/function can cause indicator repainting.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("Close in British Pounds")rate = request.currency_rate(syminfo.currency, "GBP")plot(close * rate)