Support Board
Date/Time: Thu, 26 Dec 2024 01:26:39 +0000
Post From: Referencing data using sc.GetExactMatchForSCDateTime
[2015-11-24 18:32:09] |
wwwingman - Posts: 185 |
The question is, is an exact match found where -1 is returned.
sc.GetExactMatchForSCDateTime returns an exact match when it DOES NOT return -1. FWIW : I made a simple loop, looking for a secondary index with an exact same date time start as the main chart bar index. And it works 100% of the time. As I would expect. Which means, for me, there is a problem with sc.GetExactMatchForSCDateTime, or a misunderstanding on my side. With this code : 100% correct indexes. for ( int _barIndex = sc.UpdateStartIndex ; _barIndex < sc.ArraySize - 1 ; _barIndex++ ) { // // Handle _barIndex bar // SCDateTime _startDateTime = sc.BaseDateTimeIn[_barIndex]; // compute secondary index (instead of sc.GetExactMatchForSCDateTime) int _proxyStartIndex = -1; for (int _i=0 ; _i < _proxyDateTimeData.GetArraySize() ; _i++) { if ( _startDateTime == _proxyDateTimeData[_i] ) { _proxyStartIndex = _i; break; } } if( _proxyStartIndex == -1 ) { logMsg.Format("ERROR : date<%s> _proxyStartIndex<%d>", sc.FormatDateTime(sc.BaseDateTimeIn[_barIndex]).GetChars(), _proxyStartIndex); sc.AddMessageToLog(logMsg,0); continue; } } |