Lowest
Lowest in ProBuilder returns the minimum value of a price or series over the last N bars, used for support levels, channels and stops. Syntax, examples.
Syntax
Lowest[N](price)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
N | integer | required | Number of bars scanned, counting the current bar. Must not exceed the number of bars loaded on the chart or in the backtest. |
price | series | close | Any price constant such as close, open, high, low, or any custom variable or indicator output. |
Formula
Lowest[N](price) = min( price[0], price[1], ..., price[N-1] )where price[0] is the current bar and price[N-1] the oldest bar in the window.
How it works
On each bar, ProBuilder scans a sliding window of the last N values of the given series and returns the minimum. The window always includes the bar currently being evaluated, which matters for breakout logic: on the bar where price makes a new low, Lowest[N](low) equals that new low, so low < Lowest[N](low) can never be true. Shifting the whole expression back one bar with Lowest[N](low)[1] yields the prior N-bar low, the value breakout systems actually compare against.
The function accepts any series, not just raw prices. Lowest[20](RSI[14](close)) returns the lowest RSI reading of the last 20 bars, a pattern used for normalisation, and Lowest[N](low) together with Highest[N](high) forms the Donchian channel and the denominator of the Stochastic oscillator.
Lowest answers "what is the minimum"; the companion LowestBars answers "how many bars ago did it occur".
Examples
Example 1, Adaptive lower band (Indicator)
// Use the current low when it undercuts the 30-bar lowest close
IF Low < Lowest[30](close) THEN
bandL = Low
ELSE
bandL = Lowest[30](close)
ENDIF
RETURN bandLBuilds a lower band from the smaller of the current low and the lowest close of the last 30 bars, so intrabar spikes below the closing-price floor are captured immediately.
Example 2, Donchian exit stop (ProOrder)
// Enter on a 20-bar breakout, exit at the 10-bar low
IF NOT OnMarket AND close CROSSES OVER Highest[20](high)[1] THEN
BUY 1 CONTRACT AT MARKET
ENDIF
IF LongOnMarket THEN
SELL AT Lowest[10](low) STOP
ENDIFPlaces a stop order at the lowest low of the last 10 bars, a classic trailing exit that follows the market up as new higher lows are set.
Example 3, Near the 52-week low (ProScreener)
// Daily scan for instruments within 2 percent of their one-year low
low52 = Lowest[252](low)
distance = 100 * (close - low52) / low52
SCREENER[distance < 2](distance AS "Pct above 52w low")Returns instruments whose close sits less than 2 percent above the lowest low of the last 252 daily bars, roughly one trading year.
Interpretation
The rolling minimum is the most direct definition of support: the price level that held over the chosen window. Price approaching Lowest[N](low) is testing that support, and a close below it is a range breakdown. Trend followers read a break of the N-bar low as a short entry or a long exit, while mean-reversion traders read the distance between price and the rolling low as available downside room.
Window length sets the character. Lowest[10] tracks swing lows for tight trailing stops, Lowest[252] tracks the one-year floor used in relative strength scans.
Common errors and gotchas
- The window includes the current bar.
low < Lowest[N](low)is always false. For breakdown detection, compare against the previous window:close CROSSES UNDER Lowest[N](low)[1]. Nbeyond loaded history. When fewer thanNbars are available, the result is computed on whatever exists, so early backtest values differ from chart values. Load enough history, or in automated systems raiseDEFPARAM PreloadBars.Lowestis notMIN.MIN(a, b)compares two expressions on the same bar;Lowest[N](a)scans one series through time.MINcannot take a period andLowestcannot take two series.- Value versus location.
Lowestgives the level, not the timing. To know how many bars ago the minimum printed, useLowestBars, for example to measure how stale a support level is.
Related instructions
Highest, the symmetric rolling maximum.LowestBars, number of bars since the minimum occurred.HighestBars, number of bars since the maximum occurred.MIN, minimum of two expressions on the same bar.DonchianChannelDown, packaged channel line built on the rolling low.Stochastic, oscillator normalised by the highest-lowest range.Average, moving average, the smoothing counterpart.Range, current bar's high minus low.
