• Get $30 off VIP with code SUMMER30. Ends July 27. Happy trading!

Get highest from the last 20 bars?


New member
My logic is:

Take the last 20 bars
Get the highest point
Get the lowest point that comes AFTER the high, not before and calculate the percentage difference
if the percentage difference is greater than for example 5 percent and the lowest point (that comes after the highest point not before) is higher than the first bar in the 20 bars scanned
the current bar is within less than 5 percent of the highest point
then return as result

attached is an example of what should come up

Last edited:

Similar threads