Login Page - Create Account

Support Board


Date/Time: Mon, 10 Mar 2025 23:16:28 +0000



Bug in sc.GetTradePosition()

View Count: 539

[2022-04-13 11:58:55]
Trader & Sierra++ developer - Posts: 110
Hi Sierra,

When connected to the trade simulator service, the field s_SCPositionData::Symbol filled by sc.GetTradePosition() is empty when there is no open position.

It is ok with the trade simulation mode enabled.
[2022-04-13 13:07:51]
Sierra Chart Engineering - Posts: 104368
There definitely is no bug here. Refer to the documentation for that function:

Automated Trading From an Advanced Custom Study: sc.GetTradePosition

What you describe probably is true. Since there will be no position data for the symbol.
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-04-13 13:09:21
[2022-04-13 13:16:42]
Trader & Sierra++ developer - Posts: 110
I had read the doc before and it says nothing about that issue.

of course it is a problem when a field is not reliable :
start of day => empty
open a trade => filled
close the trade => empty
open another trade => filled
close the trade => empty
...
and we get this behaviour with the trade simulator service but another behaviour with trade simulation mode.

The .symbol value depends on the moment of the day AND the current trade service.

Just not reliable at all.

At least say it in your documentation so that we don't lose time on it.
Date Time Of Last Edit: 2022-04-13 13:20:54
[2022-04-13 13:22:53]
Sierra Chart Engineering - Posts: 104368
If the symbol is not set it means that there is no position data. Whereas in the case of internal simulation mode the position data object will always exist because it is maintained in the chart.

It is perfectly reliable. You just need to understand how it works. No one has ever raised a question about this before.
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-04-13 15:46:58]
Trader & Sierra++ developer - Posts: 110
Well the purpose of the documentation is to be able to use SC API without being SC architect. When the doc is partial, the only way is to guess.

It's not straightforward to guess that a field named "Symbol" reflects the position on/off status, especially when sometimes it does not.

I suggest you add this to the documentation :
If the symbol is not set it means that there is no position data

or even better "Symbol may be empty when there is no position data".

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

Login

Login Page - Create Account