//52-week high/low
High52 = security(syminfo.tickerid, "W", highest(high, 52))
Low52 = security(syminfo.tickerid, "W", lowest(low, 52))
//WMA
WMA10 = wma(close, 10)
WMA20 = wma(close, 20)
WMA50 = wma(close, 50)
WMA100 = wma(close, 100)
WMA200 = wma(close, 200)
//Standard Deviation with WMA
lenSD = input(20, minval=1)
sdavg13 = input(title="WMA SD", type=input.integer, defval=13)
sdavg22 = input(title="WMA SD", type=input.integer, defval=22)
src = input(close, title="Source")
SD = stdev(src, lenSD)
SDWMA13 = wma(SD, sdavg13)
SDWMA22 = wma(SD, sdavg22)
//ATR with MA
lenAtr = input(title="atr length", defval=1)
oatr = atr(lenAtr)
atravg5 = input(title="WMA ATR", type=input.integer, defval=5)
atravg13 = input(title="WMA ATR", type=input.integer, defval=13)
atravg22 = input(title="WMA ATR", type=input.integer, defval=22)
ATRWMA5 = wma(oatr, atravg5)
ATRWMA13 = wma(oatr, atravg13)
ATRWMA22 = wma(oatr, atravg22)
//Volume with WMA
VOLMA5 = wma(volume, 5)
VOLMA10 = wma(volume, 10)
VOLMA20 = wma(volume, 20)
//Pocket Pivot
greenDay = close >= close[1]
redDay = close < close[1]
highVolume = highest(volume, 10)
Redvolume = iff(redDay, volume, 0)
Greenvolume = iff(greenDay, volume, 0)
TopGreenV = highest(Greenvolume, 10)
TopRedV = highest(Redvolume, 10)
PocketPivotVol = volume > TopRedV
PocketPivotDay = PocketPivotVol and greenDay
// VARIABLES
Blue = close > High52 * 0.75 and close > Low52 * 1.3 and WMA50 > WMA100 and
WMA50 > WMA200 and WMA100 > WMA200 and
SD < SDWMA13 and SD < SDWMA22 and SDWMA13 < SDWMA22 and
oatr < ATRWMA5 and oatr < ATRWMA13 and oatr < ATRWMA22 and ATRWMA5 < ATRWMA13 and
ATRWMA13 < ATRWMA22 and
volume < VOLMA5 and volume < VOLMA10 and volume < VOLMA20 and VOLMA5 < VOLMA10 and
VOLMA10 < VOLMA20 and low <= WMA10
// PLOT
plotshape(Blue, title="Blue dot", text="+", textcolor=color.white, style=shape.circle, location=location.bottom, color=color.navy, transp=0, size=size.tiny)
plotshape(PocketPivotDay ? 1 : na, title="Pocket Pivot", style=shape.triangleup, location=location.belowbar, color=color.navy, size=size.tiny)
plot(High52, title='52 Week High', trackprice=true, color=color.orange, offset=-9999)
plot(Low52, title='52 Week Low', trackprice=true, color=color.orange, offset=-9999)