Login Page - Create Account

Support Board


Date/Time: Fri, 03 May 2024 21:54:00 +0000



ACSIL Currency conversion

View Count: 753

[2020-04-05 12:45:40]
ACWalker - Posts: 6
Hello,

I am working on a position sizer, and I would like to be able to convert an account balance in a currency to the currency relevant to the chart.
I suspect the ConvertCurrencyValueToCommonCurrency() function could do this, but I can't seem to get it to work.
For example, for an account balance in GBP on a EURUSD chart I am calling it like this:

SCString outputCurrency;
SCString sourceCurrency = "GBP";
float currency = sc.ConvertCurrencyValueToCommonCurrency(Input_AccountBalance.GetFloat(), sourceCurrency, outputCurrency);

However, the returned currency value is the same value as the inputted currency and the outputCurrency is an empty string. Am I calling the function wrong?

Thanks,

Alex
[2020-04-05 13:18:55]
bradh - Posts: 854
If your account is in GBP (output currency), and the chart symbol is EURUSD (source Currency), then try this:

SCString outputCurrency = "GBP";
SCString sourceCurrency = "EURUSD";

Date Time Of Last Edit: 2020-04-05 13:19:09
[2020-04-05 14:34:08]
ACWalker - Posts: 6
Thanks for your reply,

I have tried it as you mentioned, but unfortunately still getting the same result. I'm using a value now for the example, and the currency value being returned is 500.


  SCString outputCurrency = "EURUSD";
  SCString sourceCurrency = "GBP";
  float currency = sc.ConvertCurrencyValueToCommonCurrency(500.0f, sourceCurrency, outputCurrency);

[2020-04-05 16:32:26]
User907968 - Posts: 802
Did you set the 'Common Profit/Loss Currency' to GBP?

Global Trade Settings Windows: Common Profit/Loss Currency (Global Settings >> General Trade Settings >> General)
[2020-04-12 01:33:01]
Sierra Chart Engineering - Posts: 104368
You have the second parameter wrong. The second parameter is as follows:
const SCString& SourceSymbol

It needs to be set to EURUSD

You also need to set the common currency as explained in post #4. Here is the updated documentation:
sc.ConvertCurrencyValueToCommonCurrency()
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2020-04-12 01:35:14

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account