Login Page - Create Account

Support Board


Date/Time: Mon, 06 May 2024 00:42:03 +0000



s_SCPositionData members - LastEntryDateTime & LastExitDateTime

View Count: 562

[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
[2017-04-28 05:07:26]
Sierra Chart Engineering - Posts: 104368
That is the right method. However, you might want to use the functions to get a nearest match instead of a containing match.

are orders that haven't filled and which are cancelled considered "Positions?"
No.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account