Search code examples
pine-scripttradingtradingview-apipine-script-v5pine-script-v4

"Highest value offset for a given number of bars back" meaning?


I'm new to Pine script, please, anyone explain me exactly what this high[abs(highestbars(amplitude))] statement returns, specially in highestbars(2) definition what it mean Highest value offset?? FYI this statement is from Tradingview.com HalfTrend script, thanks


Solution

  • highestbars() will give you the bar index offset of the highest bar in the given range.

    For example, if highestbars(5) returns -2, you know that the highest bar within the last 5 bars was 2 bars ago.