This Pine Script v6 indicator implements the fixed experiment above. Select Bottom or Top, inspect C (candidate), V (confirmation), R (cancellation), E (expiry) and F (failure) on the bars when those facts become available. The orange line is the frozen threshold while a candidate or watch is active. TradingView documents that barstate.isconfirmed becomes true on the closing update of a realtime bar.
Educational detector, not a trading strategy. Thresholds are fixed in the source. No future pivots, plot offsets, higher-timeframe requests, orders or performance statistics are used.pine
//@version=6
indicator("V reversal: fixed close-only experiment", overlay = true)
mode = input.string("Bottom", "Direction", options = ["Bottom", "Top"])
float direction = mode == "Bottom" ? 1.0 : -1.0
float x = direction * close
// Phase 0: idle; 1: candidate; 2: three-bar failure watch.
var int phase = 0
var int armedBar = na
var int confirmedBar = na
var float threshold = na
bool armed = false
bool confirmed = false
bool rejected = false
bool expired = false
bool failed = false
bool enoughData = not na(close[3])
bool positivePrices = enoughData and math.min(math.min(close, close[1]), math.min(close[2], close[3])) > 0
bool fallingLeg = enoughData and x < x[1] and x[1] < x[2] and x[2] < x[3]
float legSize = enoughData ? x[3] - x : na
bool setup = positivePrices and fallingLeg and legSize / close[3] >= 0.06
if barstate.isconfirmed
if phase == 0
if setup
threshold := x + 0.8 * legSize
armedBar := bar_index
phase := 1
armed := true
else if phase == 1
int age = bar_index - armedBar
// A flat or adverse close cancels before confirmation is checked.
if x <= x[1]
rejected := true
phase := 0
else if x >= threshold
confirmed := true
confirmedBar := bar_index
phase := 2
else if age >= 3
expired := true
phase := 0
else
int age = bar_index - confirmedBar
if x < threshold
failed := true
phase := 0
else if age >= 3
phase := 0
plot(phase != 0 ? direction * threshold : na, "Frozen 80% level", color.orange, style = plot.style_linebr)
plotshape(armed, title = "Candidate", style = shape.circle, location = location.abovebar, color = color.gray, text = "C")
plotshape(confirmed, title = "Confirmed", style = shape.diamond, location = location.abovebar, color = color.blue, text = "V")
plotshape(rejected, title = "Rejected", style = shape.xcross, location = location.belowbar, color = color.orange, text = "R")
plotshape(expired, title = "Expired", style = shape.xcross, location = location.belowbar, color = color.gray, text = "E")
plotshape(failed, title = "Failed within 3 bars", style = shape.xcross, location = location.belowbar, color = color.red, text = "F")
alertcondition(confirmed, "V rule confirmed", "The fixed close-only V rule confirmed on this bar.")
alertcondition(failed, "V rule failed", "Price closed back through the frozen recovery level within three bars.")