Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 17:51:49 +0000



Post From: Potential Bug With sc.GetTradePosition?

[2024-05-20 15:59:33]
PS - Posts: 40
I've made some edits, but still running into the same issues. Towards the beginning of my code (after all variables have been initialized, first bar in backtest handled, etc.), I run the following code:

s_SCPositionData PositionData;
sc.GetTradePosition(PositionData);
int current_position = PositionData.PositionQuantity;
SCString log_position;
log_position.Format("Current Position = %i", PositionData.PositionQuantity);
sc.AddMessageToLog(log_position, 0);

Despite several trades showing up in the backtest trade log, current position = 0 in every single log message print. Am I still implementing this incorrectly?