RRG Velocity scripting

I need to create custom code which compares the last Jdkrs.velocity reading with the highest Jdkrs.velocity value from n periods back.
Can anybody help me with this script?

Hi Cezar,

You can use the HIGHESTHIGH() function to look back after the last n periods. This example is for 10 bars (ie 10 days on a daily timeframe, or 10 weeks on a weekly). Change the $Bars value to adjust the lookback period:

//Set lookback period;
$Bars=10;
//Calc velocity;
V1=JDKRS().Velocity;
//New high signal;
V1>HIGHESTHIGH(V1, BARS=$Bars)

In this example of the SPDR sector ETFs, 4 made their highest velocity over the last 10 days today (ie increasing relative momentum) as they head further in to Lagging ($XLRE will probably be there tomorrow).

The last line of the formula can be changed to LOWESTLOW() to see those slowing down ($XLE ahead of a potential turn in to Improving). Workbook attached.
RRG - Velocity.owb (38.8 KB)