Login Page - Create Account

Support Board


Date/Time: Thu, 28 Nov 2024 18:38:18 +0000



Is PositionData.PositionQuantity available in Replay Mode?

View Count: 318

[2023-04-12 04:38:15]
wadams - Posts: 4
Within a study I'm writing, I have this code that gets updated every bar (using BHCS_BAR_HAS_CLOSED):


s_SCPositionData positionData;
sc.GetTradePosition(positionData);
int positionSize = positionData.PositionQuantity;

I'm running the study on a chart in replay mode. Is PositionQuantity supposed to be populated?

I think the answer is no, because only the positions that show up on the "Trade >> Trade Positions Window" will get pulled in using `sc.GetTradePosition()`. But I wanted to ask as a sanity check.
[2023-04-12 09:45:37]
ForgivingComputers.com - Posts: 960
Yes, it works in SIM mode too. If it is in the Trade Position Window, then it will be counted. Remember it is only for the account/symbol of the chart.
[2023-04-12 13:00:45]
wadams - Posts: 4
Thanks for the help, bradh.

Here's some context that I left out which was critical: I was using the "Jump >> To Next Bar" functionality. It seems like when jumping around, the PositionQuantity, AveragePrice and some other properties on an s_SCPositionData object don't get set.

When I run the Replay without jumping, the s_SCPositionData gets populated.

So, user ignorance on my part. <insert Implications meme>

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

Login

Login Page - Create Account