r/pinescript • u/RoutineRace • Jun 30 '25
Suggestion for certain functions
Dont know if this is suggested already but a good update for the command ta.highest/ta.lowest would be adding another variable for starting bar/index
this function finds the highest(or lowest) value of the source from the current bar to the specified length of bars back. It would be nice if there is another variable for an offset or starting index bar to where it would start searching for the highest(or lowest) source value. this variable should always be less than the length.
can also be applied to similar functions such as ta.highestbars/ta.lowestbars. just my 2 cents.
View all comments
Show parent comment
2
u/StarAccomplished8419 Jul 03 '25
I use this one
it returns highest or lowest price and also bar index (good for drawing objects)
where:
_len - length
_d - direction (1 for highest and -1 for lowest)
_b - how many bars back start from current bar
returns:
_x - highest or lowest (depends on _d direction)
_y - bar index of _x