Login Page - Create Account

Support Board


Date/Time: Tue, 07 May 2024 19:22:54 +0000



Post From: GetTradePosition returns 0 while it should return -4

[2020-11-05 20:14:36]
User888583 - Posts: 19
Problem is not with the study "Trading: Position Quantity" actually this study reports position quantity properly.

What we are looking for is how to get reliable Position Quantity in ASCIL.
I used following code - but do not work always when you hit Insert.

For example, open 1 contract long, it will return +1, but when you hit Insert everything recalculate and this code will return 0 while in reality you have exposure "1". After some time it start reporting quantity properly.

s_SCPositionData PositionData;
int Result = sc.GetTradePosition(PositionData);
if (Result == SCTRADING_ORDER_ERROR)
{
// error with getting pos data
return;
}
int Quantity = PositionData.PositionQuantity;
// I am using Quantity in my Study

How can we get Position Quantity in ascil in reliable way?

Thanks,
Lukasz