4 ms·
You can do it in a single pass fairly easily. Loop over the rows of data. Store the current high to low, as well as the largest high to low since inception. If
by hntrader 6y ago
You can do it in a single pass fairly easily. Loop over the rows of data. Store the current high to low, as well as the largest high to low since inception. If the current exceeds the largest since inception, simply replace it. Should be about 30 lines of code.