Skip to content
Algo Trade Analytics Docs

strategy.convert_to_symbol() - Pine Script Function

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

strategy.convert_to_symbol(value) → series float
NameTypeDescription
valueseries int/floatThe value to be converted.
//@version=6
strategy("`strategy.convert_to_symbol` Example", currency = currency.EUR)// Calculate the max qty we can buy using current chart's currency.calcContracts(accountMoney) => math.floor(strategy.convert_to_symbol(accountMoney) / syminfo.pointvalue / close)// Return max qty we can buy using 300 eurosqt = calcContracts(300)// Strategy calls to enter long trades every 15 bars and exit long trades every 20 bars using our custom qty.
if bar_index % 15 == 0
strategy.entry("Long", strategy.long, qty = qt)
if bar_index % 20 == 0
strategy.close("Long")