Returns the highest value of source over the last length bars, including the current one.
ta.highest scans the window of length values and returns the largest. With a single argument, ta.highest(length), the source is the bar high.
Until length bars have printed the result is na, and an na inside the window also gives na.
Syntax
ta.highest(source: series int/float, length: series int) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| source | series int/ | required | Series to scan. Leave it out, passing only the length, to scan high. |
| length | series int | required | Number of bars in the window. A whole number of 1 or more. |
Returns
series float: the largest value in the window, or na while it is not full.
Remarks
- Compare the current bar against
ta.highest(high, n)[1] to test for a breakout of the previous n bars.
Example
//@version=6
indicator("Highest high", overlay = true)
len = input.int(20, "Length", minval = 1)
plot(ta.highest(high, len), "Highest high", color = color.green)
plot(ta.lowest(low, len), "Lowest low", color = color.red)See also
Runs on Sidechair