Lookup
|
Date/Time |
SYNTAX | Lookup( array, datetime, mode = 0 ) |
RETURNS | NUMBER |
FUNCTION | The function searches for the bar with specified datetime and returns the value from the same position of the input array. Parameter 'mode' decides how search is performed in case when exact match is not found:
This function uses very fast binary search and it is many times faster than previous AFL-based methods such as FindValueAtDateTime() presented in the past. Any call to FindValueAtDateTime ( input, dt, value ) can be now replaced with Lookup( input, value ) (here is no need to pass dt- datetime). NOTE: This function does not affect QuickAFL required bars, therefore it will only search bars that are actually loaded in arrays. For indicators it may mean that it won't be able to find value if it is invisible, unless you use SetBarsRequired() function to ensure that more bars are loaded. |
EXAMPLE | InputDate = "2011-04-05"; |
SEE ALSO | DateTime() function , StrToDateTime() function , _DT() function |
The Lookup function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.