Support Board
Date/Time: Sat, 15 Mar 2025 02:37:19 +0000
s_SCPositionData Variable .OpenProfitLoss Does Not Return Correct Value On Sim Mode
View Count: 1124
[2021-02-18 16:00:43] |
User36703 - Posts: 29 |
Hello, I have found the issue with s_SCPositionData variable in case of calling for .OpenProfitLoss in new released versions. In case of live trading mode, it is ok and it gives correct value. But in simulation mode it gives absolutely different number which does not make sense (e.g. 20 C vs -161215 C in debug mode). When I was building the code last year, it was working ok. I am getting PositionData variable through this logic: s_SCPositionData PositionData; sc.GetTradePositionForSymbolAndAccount(PositionData, EntryOrderDetails.Symbol, sc.SelectedTradeAccount); Sierra Chart support, please can you check what is the difference now and correct it if needed? Thank you. |
[2022-07-08 10:20:19] |
User36703 - Posts: 29 |
It has been more than a year I have not found a solution, no response here. It is needed for my portfolio money management features running on Sierra Chart. I am able to pay for programming help from Sierra engineers to get it done. I found when s_SCPositionData positionData gets the data of the symbol which is the same where is my ACSIL study applied, I get positionData.OpenProfitLoss I do not understand, e.g. 948700. If it is applied from the study running on different trading symbol, I get the value in Points, in this case -28.00 P. The value of positionData.OpenProfitLoss should the same I believe or somehow to be recalculated on the same chart symbol. Please can you navigate me what I can do with that to get the same values? |
![]() |
[2022-07-08 10:31:51] |
|
We apologize post #1 was overlooked. Is what you are describing in post #2 the only outstanding issue? Are there any outstanding issues in post #1? If there is an incorrect Open Profit/loss value it must be related to an incorrect average price. We need to know if you are currently experiencing that issue but we would think not. 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 |
[2022-07-08 10:47:03] |
User36703 - Posts: 29 |
Yes, it is only the issue in the post #2 currently running on the build 2411, I think it is the same isuue as described in the post #1, but more specifically. s_SCPositionData positionData.AveragePrice is the same for the both studies running simultaneously on different traded symbols. You can see on the screenshot provided. |
[2022-07-08 10:59:55] |
|
Due to how everything is structured internally in the case of simulated trading, it probably is not possible to determine the Open Profit/Loss, when you specify a symbol for a position different than the symbol of the chart the trading study is on which is making the call. In which case we just have to set it to 0. You can calculate this yourself by obtaining the current pricing data: ACSIL Interface Members - Functions: sc.GetSymbolDataValue() 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: 2022-07-08 11:01:05
|
[2022-07-08 11:11:15] |
User36703 - Posts: 29 |
I think you do not understand correctly, I am getting positionData.OpenProfitLoss in Points from a symbol for a position different than the symbol of the chart the trading study is on which is making the call. I can work with that, e.g. using Currency Value Per Tick and Tick Size stored in Symbol Settings. But I got this unclear value if I making call from the same symbol where is an opened position. |
[2022-07-12 19:55:56] |
Sierra_Chart Engineering - Posts: 18789 |
For what symbol does this occur with and is this with simulated or live trading? We cannot reproduce the issue. We get a currency value for the Open Profit/Loss. We are using the trading evaluator service and using this test code: s_SCPositionData PositionData;
sc.GetTradePositionForSymbolAndAccount ( PositionData , "NQU22" , sc.SelectedTradeAccount ); 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: 2022-07-12 19:56:21
|
[2022-07-13 07:24:30] |
User36703 - Posts: 29 |
It does appear with a symbol for the same position of the symbol of the chart the trading study is on which is making the call. It does not matter which a specific one is applied. Short is always negative, long always positive. int iOrder = 0;
s_SCTradeOrder entryOrderDetails; while (sc.GetOrderForSymbolAndAccountByIndex("", sc.SelectedTradeAccount, iOrder, entryOrderDetails) != SCTRADING_ORDER_ERROR) { iOrder++; if (entryOrderDetails.OrderStatusCode == SCT_OSC_FILLED) { s_SCPositionData positionData; if (sc.GetTradePositionForSymbolAndAccount(positionData, entryOrderDetails.Symbol, sc.SelectedTradeAccount)){ .... I use simulaton mode for development and testing, but I can try out live mode as well if needed. As Sierra Engeineer had suggested I tried build a workaround with sc.GetSymbolDataValue() function. I managed to get last price information and then I made calculation of Open PnL by myself. For me this workaround solves the problem in the moment. Date Time Of Last Edit: 2022-07-13 07:35:31
|
![]() ![]() |
[2022-07-13 07:25:46] |
User36703 - Posts: 29 |
OpenProfitLoss in points in case of a call from a symbol for a position different than the symbol of the chart the trading study is on which is making the call.
|
![]() |
To post a message in this thread, you need to log in with your Sierra Chart account: