Convert to Currency
The Convert to Currency rule converts numeric values into properly formatted currency amounts, or exchanges one currency amount into a different currency. Use this rule to ensure that monetary values in your strategy are correctly typed and formatted for use with order placement and risk management rules.
How It Works
The Convert to Currency rule operates in two modes. In Parse mode, it takes a plain decimal number and converts it into a currency amount with the specified currency code. This is useful when you have calculated a monetary value using arithmetic rules and need to format it as a proper currency amount before passing it to an order or risk rule.
In Exchange mode, the rule takes an existing currency amount and converts it into a different currency using the applicable exchange rate. This is essential for multi-currency strategies where you need to express values in your account's base currency, or when you need to convert a risk amount from one currency to the currency of the instrument you are trading.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
| Conversion Type | Selection | Yes | The conversion mode to use. Parse converts a decimal number to a currency amount. Exchange converts a currency amount to a different currency. Default: Parse. |
| Decimal Number | Number | When Parse | The plain decimal number to convert into a currency amount. Used only in Parse mode. |
| Currency Amount | Currency | When Exchange | The source currency amount to convert into a different currency. Used only in Exchange mode. |
| Currency Code | String | Yes | The target currency code (e.g., USD, EUR, GBP, AUD). In Parse mode, this sets the currency of the output. In Exchange mode, this is the currency you are converting to. |
Outputs
| Output | Type | Description |
|---|---|---|
| Currency Amount | Currency | The resulting currency amount, formatted with the appropriate currency code and decimal precision for that currency. |
Tips
When building multi-currency strategies, use Exchange mode to normalise all monetary values to a single base currency for accurate risk calculations. For example, if your account is denominated in USD but you are trading a EUR-based instrument, convert your risk amount to EUR before passing it to your position sizing rules. This ensures that your intended risk per trade is accurately reflected regardless of the instrument's denomination.
Was this helpful? Let us know