Login Page - Create Account

Support Board


Date/Time: Sun, 09 Feb 2025 04:06:19 +0000



Post From: Datatypes double not int on 64 bit version, here s_SCPositionData

[2020-08-05 16:58:21]
ForgivingComputers.com - Posts: 999
what is the reason for sc.GetTradePosition is always returning 1, even if there is absolutely no position for the instrument/symbol? How determine this best then if there is no position?

sc.GetTradePosition returns a 1 when the function was able to get the position, not that there is a position of 1. When you are flat, you have a position with a quantity of zero.

To check the quantity of the position, use the result of sc.GetTradePosition(PositionData):


s_SCPositionData PositionData;
sc.GetTradePosition(PositionData);
int OpenQty = (int)PositionData.PositionQuantity;

if (OpenQty != 0)
{
// OpenQty : Positive for Long, Negative for Short
}
else
// No position