RicardoSantos

[RS]Fractal Levels V0

EXPERIMENTAL: fractal levels experiment

Open-source script

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.

Want to use this script on a chart?
study("[RS]Fractal Levels V0", shorttitle="[RS]FL.V0", overlay=true)
topfractal = high < high[1] and high[1] < high[2] and high[2] > high[3] and high[3] > high[4]
botfractal = low > low[1] and low[1] > low[2] and low[2] < low[3] and low[3] < low[4]

plotchar(topfractal, text="Fractal", location=location.abovebar, offset=-2)
plotchar(botfractal, text="Fractal", location=location.belowbar, offset=-2)

topfractals = topfractal ? high[2] : topfractals[1]
botfractals = botfractal ? low[2] : botfractals[1]

topfcolor = topfractals != topfractals[1] ? na : black
botfcolor = botfractals != botfractals[1] ? na : black

plot(topfractals, color=topfcolor)
plot(botfractals, color=botfcolor)