Support Board
Date/Time: Mon, 13 Jan 2025 17:19:11 +0000
Post From: s_SCPositionData members - LastEntryDateTime & LastExitDateTime
[2017-04-28 02:04:42] |
User553714 - Posts: 184 |
Hi, I am using the following method to retrieve the bar Index of the LastEntryDateTime & LastExitDateTime of the last position; SCDateTime LastEntryDateTime = PositionData.LastEntryDateTime; PositionEntryIndex = sc.GetContainingIndexForSCDateTime(sc.ChartNumber, LastEntryDateTime); SCDateTime LastExitDateTime = PositionData.LastExitDateTime; PositionExitIndex = sc.GetContainingIndexForSCDateTime(sc.ChartNumber, LastExitDateTime); Would this be the most reliable way of retrieving the Index of the last position (Entry & Exit) or can you suggest a better method? I am asking since at times the method works perfectly at other times it seems to become unreliable. I think it may be related to when I am cancelling orders that haven't filled; are orders that haven't filled and which are cancelled considered "Positions?" In such a circumstance using the above method for retrieving the "LastExitDateTime" BarIndex recursively returns the Current sc.Index which seems like odd behaviour as I am using "PositionData.LastExitDateTime"? Any suggestions will be appreciated. Thanks |