indicator · on price · open source
Discount Array (OB Cluster)
Running…
Loading chart…
About
Discount Array stacks the bottom boundaries of recent bullish order blocks below the current price. Mirror of the premium array.
- Plot the most recent
maxObsbullish OB bottoms. - A cluster of OBs in a tight band = the institutional long zone.
- Combine with a discount filter (price below 50% range) for highest-probability longs.
Source code
//@version=5
indicator("Discount Array (OB Cluster)", overlay=true)
swing = input.int(5, "Swing Length", minval=2, maxval=50)
maxObs = input.int(5, "Max OBs", minval=1, maxval=10)
lookback = input.int(30, "OB Lookback", minval=5, maxval=100)
ph = ta.pivothigh(high, swing, swing)
var float lastPh = na
var float prevPh = na
var float ob1 = na
var float ob2 = na
var float ob3 = na
var float ob4 = na
var float ob5 = na
if not na(ph)
prevPh := lastPh
lastPh := ph
if not na(lastPh) and not na(prevPh) and lastPh > prevPh
found = false
for i = 1 to math.min(lookback, swing * 4)
if not found and close[i] < open[i]
ob5 := ob4
ob4 := ob3
ob3 := ob2
ob2 := ob1
ob1 := low[i]
found := true
break
p_Bull_OB_1 = plot(ob1, "Bull OB 1", color=color.green, style=plot.style_linebr)
p_Bull_OB_2 = plot(ob2, "Bull OB 2", color=color.lime, style=plot.style_linebr)
p_Bull_OB_3 = plot(ob3, "Bull OB 3", color=color.lime, style=plot.style_linebr)
p_Bull_OB_4 = plot(ob4, "Bull OB 4", color=color.lime, style=plot.style_linebr)
p_Bull_OB_5 = plot(ob5, "Bull OB 5", color=color.lime, style=plot.style_linebr)
alertcondition(not na(ob1) and na(ob1[1]), "New bullish OB added", "Bullish OB added to discount array")
No comments yet.
Sign in to comment.