lowest_bars_ago
Bars ago when lowest value occurred
lowest_bars_ago(source, period)
Parameters
| Name | Type | Description |
|---|---|---|
source |
field | Data series |
period |
int | Lookback period |
Formula
lowest_bars_ago = sample_number - sample_number of ARG_MIN(source) over the trailing period window
Examples
// lowest close right now (fresh 20-bar low)
lowest_bars_ago(close, 20) == 0;
// lowest occurred more than 10 bars ago (recovering)
lowest_bars_ago(low, 50) > 10;
// lowest within last 5 bars (recent weakness)
lowest_bars_ago(close, 20) < 5;
Returns
int
Range
period must be 2-400
Notes
NULL when source is NULL on every bar of the trailing window -- e.g. a nested indicator source still in its own warm-up