Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 03:44:09 +0000



Post From: Position quantity with GetTradePosition is 0 on Teton Order Routing

[2023-04-27 15:12:12]
glacialspring - Posts: 26
The trade positions window shows the data correctly. I also tried the Trading: Position Quantity study and that is also working correctly. I tried writing a barebones test (below) of the GetTradePosition function and it was not working correctly for this account. I've attached a screenshot, sorry haven't had time to read your screenshot guidelines but I think it is clear enough.

I'll go ahead and check all of the values of the position data structure now.

#include "sierrachart.h"

SCDLLName("Test")

SCSFExport scsf_Test(SCStudyInterfaceRef sc)
{
SCSubgraphRef sgPositionQuantity = sc.Subgraph[0];

if(sc.SetDefaults)
{
sc.GraphName = "Test";
sc.AutoLoop = 0;
    
sgPositionQuantity.Name = "quantity";
sgPositionQuantity.LineStyle = LINESTYLE_SOLID;
sgPositionQuantity.PrimaryColor = RGB(0,255,0);

return;
}

s_SCPositionData pos;
if (sc.GetTradePosition(pos) == SCTRADING_ORDER_ERROR) {
sc.AddMessageToLog("error getting position", 1);
return;
}

for (int i = sc.UpdateStartIndex; i < sc.ArraySize-1; i++) {
sgPositionQuantity[i] = pos.PositionQuantity;
}
}

imagequantitytest.png / V - Attached On 2023-04-27 15:04:16 UTC - Size: 76.86 KB - 122 views