Skip to content
Algo Trade Analytics Docs

strategy.convert_to_account() - Pine Script Function

Converts the value from the currency that the symbol on the chart is traded in (syminfo.currency) to the currency used by the strategy (strategy.account_currency).

strategy.convert_to_account(value) → series float
NameTypeDescription
valueseries int/floatThe value to be converted.
// Calculates the "Buy and hold return" using your account's currency.//@version=6
strategy("`strategy.convert_to_account` Example 2", currency = currency.EUR)
dateInput = input.time(timestamp("20 Jul 2021 00:00 +0300"), "From Date", confirm = true)buyAndHoldReturnPct(fromDate) =>
if time >= fromDate money = close * syminfo.pointvalue var initialBal =
strategy.convert_to_account(money) (strategy.convert_to_account(money) - initialBal) / initialBal * 100
plot(buyAndHoldReturnPct(dateInput))