Finding the Highest and Lowest Prices Within a Bar Window
Summary
The document presents helper routines for locating the highest high and lowest low in a series of price bars. Each routine uses a technical analysis function to find the extreme within a requested range, then scans the records to identify the bar containing that price. It returns the record, its index, and the range, or false when there are too few records or no preceding bar is available.
A demo repeatedly fetches market candles, plots the records, and draws horizontal lines at the selected high and low. The example illustrates how to visualize recent extremes, but it does not explain the indicator library’s range conventions or show tests across different inputs. Its handling of equal extreme prices and the default range may affect which bar is returned, so these details should be checked before adapting the routines for signals or trading decisions.
Key ideas
- The routines identify the highest high or lowest low over a specified bar range.
- They return the matching candle, its index, and the range used.
- They reject short input series and cases without an earlier bar.
- The demo plots candle data and horizontal lines at the identified extremes.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.