Sure, here is an example of how you could do this using TradingView's pine scripting language:
//@version=4
study("High/Low Marker", shorttitle="HLM", overlay=true)
// Define the timeframe for the highs and lows
timeframe = "15"
// Calculate the highs and lows
highs = security(syminfo.tickerid, timeframe, high)
lows = security(syminfo.tickerid, timeframe, low)
// Find the highest high and lowest low
highestHigh = ta.highest(highs, 20)
lowestLow = ta.lowest(lows, 20)
// Define the range for the markers
range = highestHigh - lowestLow
// Create the markers
if (high > highestHigh - range*0.25)
label.new(bar_index[1], high, text="1", color=color.yellow, style=label.style_labelup, textcolor=color.black)
plotshape(series=high, location=location.abovebar, color=color.yellow, style=shape.labelup, text="1")
if (low < lowestLow + range*0.25)
label.new(bar_index[1], low, text="1", color=color.yellow, style=label.style_labeldown, textcolor=color.black)
plotshape(series=low, location=location.belowbar, color=color.yellow, style=shape.labeldown, text="1")
if (high > highestHigh - range*0.50)
label.new(bar_index[1], high, text="2", color=color.yellow, style=label.style_labelup, textcolor=color.black)
plotshape(series=high, location=location.abovebar, color=color.yellow, style=shape.labelup, text="2")
if (low < lowestLow + range*0.50)
label.new(bar_index[1], low, text="2", color=color.yellow, style=label.style_labeldown, textcolor=color.black)
plotshape(series=low, location=location.belowbar, color=color.yellow, style=shape.labeldown, text="2")
if (high > highestHigh - range*0.75)
Region 3
label.new(bar_index[1], high, text="3", color=color.yellow, style=label.style_labelup, textcolor=color.black)
plotshape(series=high, location=location.abovebar, color=color.yellow, style=shape.labelup, text="3")
if (low < lowestLow + range*0.75)
label.new(bar_index[1], low, text="3", color=color.yellow, style=label.style_labeldown, textcolor=color.black)
plotshape(series=low, location=location.belowbar, color=color.yellow, style=shape.labeldown, text="3")
This script will find the highest high and lowest low for the past 20 bars (you can adjust this value by changing the number in the ta.highest() and ta.lowest() functions) and mark them with a yellow label and text. The text on the labels will be "1" for the highest high and lowest low, "2" for the second highest high and second lowest low, and "3" for the third highest high and third lowest low.
Note that this script uses the 15-minute timeframe by default, but you can change this by modifying the value of the timeframe variable at the top of the script.
I hope this helps! Let me know if you have any questions.
Sincerely,
The TradingView Support Team