In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
study("[RS]Fractal Levels V0", shorttitle="[RS]FL.V0", overlay=true) topfractal = high < high and high < high and high > high and high > high botfractal = low > low and low > low and low < low and low < low plotchar(topfractal, text="Fractal", location=location.abovebar, offset=-2) plotchar(botfractal, text="Fractal", location=location.belowbar, offset=-2) topfractals = topfractal ? high : topfractals botfractals = botfractal ? low : botfractals topfcolor = topfractals != topfractals ? na : black botfcolor = botfractals != botfractals ? na : black plot(topfractals, color=topfcolor) plot(botfractals, color=botfcolor)