Login Page - Create Account

Support Board


Date/Time: Fri, 27 Dec 2024 16:24:54 +0000



Post From: *Technical Issue* sc.GetTradePosition(PositionData) NOT updating PositionQuantity

[2016-03-30 03:37:53]
User972044 - Posts: 154
Somehow after I exited the trade via the sc.FlattenPosition(); statement, and then when I call s_SCPositionData PositionData and sc.GetTradePosition(PositionData); the two statements again, and then when I check the PositionData.PositionQuantity, the PositionQuantity does NOT get updated at all. I actually check it in a log, and the log still shows PositionQuantity reflecting the outstanding trade quantity when in fact the position has already been flattened via the sc.FlattenPosition(); statement. I actually designed my trading system to immediately enter into a trade in the opposite direction as soon as the previous position is closed on the same bar as long as the entry condition is met and I have set sc.SupportReversals = true; and sc.AllowOnlyOneTradePerBar = false; but in order to prevent overtrading, I actually check the PositionData.PositionQuantity before I enter a new trade. Now with PositionQuantity not being updated after the position is flattened, I have to create a position counter manually updating and keeping track of my trade amount.

Can you look into this to find out this sc.GetTradePosition(PositionData) does not reflect the correct PositionQuantity when it's called? According to your documentation, the copy of the PositionData is supposed to be updated each time when sc.GetTradePosition(PositionData) is called. So after a trade is closed, it should be already reflected in the database and when sc.GetTradePosition(PositionData) is called it's supposed to report the new quantity.

Thanks for your help in advance
Date Time Of Last Edit: 2016-03-30 03:38:14