Support Board
Date/Time: Sat, 20 Dec 2025 11:00:14 +0000
Post From: Inconsistent results with GetNearestMatchForSCDateTime
| [2025-11-01 17:22:42] |
| User431178 - Posts: 829 |
|
What is the array size each time you call GetNearestMatchForSCDateTime? If, when the first message, index 202 is last bar in chart (sc.ArraySize-1), then it would be expected to give different answer when a new bar (203) is added, as your timestamp is then nearer to start time of the next bar. ACSIL Interface Members - Functions: sc.GetNearestMatchForSCDateTime() Matching Rules for a Nearest Date-Time Match 1. If an exact match can be done, then the index with the exact match will be returned. If there are repeating timestamps, then the first index in the repeating times is given. 2. If there is not an exact match, then the index of the nearest matching date-time is given. 3. If the given date-time is equidistant between two date-times, then the index for the higher date-time is given. rule 2 applies as you don't have an exact time match to the start of the bar. I would love to know how to work around this or how to resolve it. Don't use sc.GetNearestMatchForSCDateTime, use sc.GetContainingIndexForSCDateTime instead? ACSIL Interface Members - Functions: sc.GetContainingIndexForSCDateTime() Or I might be totally wrong. |
