Login Page - Create Account

Support Board


Date/Time: Wed, 30 Apr 2025 07:54:01 +0000



Post From: Issue with sc.GetTradePositionForSymbolAndAccount() possible bug?

[2025-04-26 00:22:29]
LTSys2 - Posts: 25
I have a study that when it starts it immediately calls...


s_SCPositionData position1;
s_SCPositionData position2;

sc.GetTradePositionForSymbolAndAccount(position1, BTCUSD_PERP_BINANCE, accountName);
sc.GetTradePositionForSymbolAndAccount(position2, EURUSD, accountName);

sc.GetTradePositionForSymbolAndAccount(position1, BTCUSD_PERP_BINANCE, accountName);
sc.GetTradePositionForSymbolAndAccount(position2, EURUSD, accountName);

And for some reason I am getting...

Position 1 found on the first call.
Position 2 not found on the first call.

Position 1 found on the second call.
Position 2 found on the second call.

Here is the log output...

Chart: BTCUSD_PERP_BINANCE[M] 1 Min #3 | Study: Test | INFO symbol: BTCUSD_PERP_BINANCE position quantity: 1.000000 <-- first call
Chart: BTCUSD_PERP_BINANCE[M] 1 Min #3 | Study: Test | INFO symbol: BTCUSD_PERP_BINANCE position quantity: 1.000000 <-- second call
Chart: BTCUSD_PERP_BINANCE[M] 1 Min #3 | Study: Test | INFO symbol: EURUSD position quantity: 10000.000000 <-- second call

As you can see the logs mention the study is on chart BTCUSD_PERP_BINANCE

If I flip it around and put the study on EURUSD the same thing happens but for opposite symbols...

Chart: EURUSD[M] 1 Min #3 | Study: Test | INFO symbol: EURUSD position quantity: 1.000000 <-- first call
Chart: EURUSD[M] 1 Min #3 | Study: Test | INFO symbol: EURUSD position quantity: 1.000000 <-- second call
Chart: EURUSD[M] 1 Min #3 | Study: Test | INFO symbol: BTCUSD_PERP_BINANCE position quantity: 10000.000000 <-- second call

Does this function: sc.GetTradePositionForSymbolAndAccount() get the position for any symbol and account regardless of what chart the study is on?

The function seems to do it but it isn't doing it on the first time around?

Is this a bug? If so what would be the work around for this till its fixed?

TIA
Date Time Of Last Edit: 2025-04-26 03:12:43