First you have to define the number of previous bars you want to scan to find a “highest high”.
If you want the highest high of the last 100 bars you may write:
1
2
3
4
5
6
7
8
9
ONCELookBack=100
HighestHigh=-1
HighestBar=0
FORi=0TOLookBack
IFhigh>HighestHighTHEN
HighesetHigh=high
HighestBar=i
ENDIF
NEXT
At the end of which HighestHigh will hold the highest price found and HighestBar its bar ID, 0 to 100. So if it returns 23 you can reference that cadlestick with [23] (low[23], close[23,….).