Hi TJ,
I was curious about this and took a look at the Highest function itself thinking it makes sense just to modify it. Here is what I found. It calls a function called "extremes". There is another wrapper function called HighestBar which also called "extremes" and it returns the offset instead of the value. From there you can get anything by using the offset (High, date, time, RSI, BB, etc).
I copied extremes into the code below for faster reference. It appears you can run the function itself with an offset as well. To find this out you have to look up ExecOffset which It references below. It is a command that can tell you which offset the function extremes was run with.
You know, it just occured to me that I could have used this function HighestBar/LowestBar and just recently too. Cool. Helping helped.
John.
Code: Select all
{ Multiple-output function; see MULTIPLE-OUTPUT FUNCTIONS note below }
inputs:
Price( numericseries ),
Length( numericsimple ),
HiLo( numericsimple ), { pass in 1 for Highest(Bar), -1 for Lowest(Bar) }
oExtremeVal( numericref ),
oExtremeBar( numericref ) ;
variables:
MyVal( 0 ),
MyBar( 0 ) ;
MyVal = Price ;
MyBar = 0 ;
for Value1 = 1 to Length - 1
begin
if ( HiLo = 1 and Price[Value1] > MyVal )
or ( HiLo = -1 and Price[Value1] < MyVal )
then
begin
MyVal = Price[Value1] ;
MyBar = Value1 ;
end ;
end ;
oExtremeVal = MyVal ;
oExtremeBar = MyBar + ExecOffset ;
Extremes = 1 ; { function return always 1, not used; only outputs used }