Converts an amount from the symbol's currency into the strategy's account currency.
strategy.convert_to_account(value) multiplies value by the exchange rate between the symbol's currency (syminfo.currency) and the account currency set by the currency parameter of strategy(). When the two currencies are the same, it returns value unchanged.
Use it when a figure computed from prices, such as a stop distance times a size, has to be compared with equity or profit, which are always in the account currency.
Syntax
strategy.convert_to_account(value: series int/float) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| value | series int/ | required | An amount in the symbol's currency to convert. |
Returns
series float: The amount expressed in the strategy's account currency.
Remarks
- The conversion uses the exchange rate of the current bar, so the result can differ from bar to bar when the currencies differ.
strategy.convert_to_symboldoes the opposite conversion.
Examples
//@version=6
strategy("Risk per share", overlay = false, currency = currency.EUR)
stopDist = ta.atr(14) * 2
plot(strategy.convert_to_account(stopDist), "Risk per share (EUR)", color.red)//@version=6
strategy("Currencies", overlay = true)
if barstate.islast
label.new(bar_index, high, "Symbol currency: " + syminfo.currency, style = label.style_label_down)
plot(close, "Close", color.gray)See also
Runs on Sidechair