Support Board
Date/Time: Wed, 30 Apr 2025 04:19:37 +0000
[Programming Help] - Issue with sc.GetTradePositionForSymbolAndAccount() possible bug?
View Count: 69
[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
|
[2025-04-29 17:04:57] |
Sierra_Chart Engineering - Posts: 19383 |
Does this function: sc.GetTradePositionForSymbolAndAccount() get the position for any symbol and account regardless of what chart the study is on? In the case of simulated trading, the position data in a chart will take some time to be received because there is an asynchronous request. Refer to: Trade Activity Log: Trade Activity Not Displaying or Clearing (Improving Trade Activity Query Performance) 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, use the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2025-04-29 17:06:11
|
[2025-04-29 17:50:22] |
LTSys2 - Posts: 25 |
In the case of simulated trading, the position data in a chart will take some time to be received because there is an asynchronous request.
So when not in simulation mode this is not an issue? I'm just developing right now in simulation mode. As a workaround I put in a 15 second delay before letting the study fall into the code that does the trading. |
To post a message in this thread, you need to log in with your Sierra Chart account: