This Pine indicator compares the close with the preceding observed range and current volume with the preceding volume average. It excludes the current bar from both reference windows. It does not detect triangle geometry, Ichimoku or a golden cross.
Configured range conditions, not XRP trade instructions (Pine Script v6)pinescript
//@version=6
indicator("Completed-bar range and volume conditions", overlay=true)
int rangeLength = input.int(20, "Prior range bars", minval=1, maxval=500)
int volumeLength = input.int(20, "Prior volume bars", minval=1, maxval=500)
float multiplier = input.float(1.5, "Volume multiplier", minval=0.1)
float priorHigh = ta.highest(high[1], rangeLength)
float priorLow = ta.lowest(low[1], rangeLength)
float priorVolume = ta.sma(volume[1], volumeLength)
bool ready = bar_index >= math.max(rangeLength, volumeLength) and not na(priorHigh) and not na(priorLow) and not na(volume) and not na(priorVolume) and priorVolume > 0
bool volumePass = ready and volume > priorVolume * multiplier
bool above = barstate.isconfirmed and volumePass and close > priorHigh
bool below = barstate.isconfirmed and volumePass and close < priorLow
plot(priorHigh, "Prior observed high", color=color.red)
plot(priorLow, "Prior observed low", color=color.green)
plotshape(above, title="Above range", style=shape.triangleup, location=location.belowbar, color=color.teal, size=size.small)
plotshape(below, title="Below range", style=shape.triangledown, location=location.abovebar, color=color.orange, size=size.small)
alertcondition(above, "Completed bar above range", "{{ticker}} {{interval}}: completed bar above configured prior range with volume filter.")
alertcondition(below, "Completed bar below range", "{{ticker}} {{interval}}: completed bar below configured prior range with volume filter.")