Swing Failure Pattern
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Greg_007

//@version=5
indicator("Swing Failure Pattern", overlay=true)
lookback = input.int(100, "Bars to look back")
ignore = input.int(10, "Ignore last ... bars")
char = input.string('👀', "Character to show (only 1 is allowed)")
char_color = input.color(color.blue, "Character Color")

last_high = ta.highest(lookback)
last_low = ta.lowest(lookback)
ignored_high = ta.highest(ignore)
ignored_low = ta.lowest(ignore)

plotchar(high > last_high[1]  and close < last_high[1] and last_high[1] != ignored_high[1] ? close : na, char=char, color = char_color, location=location.abovebar, size=size.small)
plotchar(low < last_low[1]  and close > last_low[1] and last_low[1] != ignored_low[1] ? close : na, char=char, color = char_color, location=location.belowbar, size=size.small)
