Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- study("Double Top Pattern", overlay=true)
- //length = input(15,title="length")
- //pvtLenL = length
- //pvtLenR = length
- //pl = pivotlow(pvtLenL, pvtLenR)
- //WaitForClose = input(true)
- //pvtlo_ = pivotlow(low, pvtLenL, pvtLenR)
- //Shunt = WaitForClose ? 1 : 0
- //pvtlo = pvtlo_[Shunt]
- //lowerlow0 = ( valuewhen(pvtlo, low[pvtLenR+Shunt], 1) > valuewhen(pvtlo, low[pvtLenR+Shunt], 0) )
- //x1 = crossunder(close,valuewhen(pvtlo, low[pvtLenR+Shunt], 0) )
- //x = x1[1] and lowerlow0 and close > open
- //x2 = low <= lowest(low,120)
- //x3 = x2[1]
- /////
- length = input(10,title="length")
- pvtLenL = length
- pvtLenR = length
- ph = pivothigh(pvtLenR, pvtLenL)
- WaitForClose = input(true)
- pvthi_ = pivothigh(high, pvtLenR, pvtLenL)
- Shunt = WaitForClose ? 1 : 0
- pvthi = pvthi_[Shunt]
- higherhigh0 = ( valuewhen(pvthi, high[pvtLenR+Shunt], 1) > valuewhen(pvthi, high[pvtLenR+Shunt], 0) )
- x1 = crossover(close,valuewhen(pvthi, high[pvtLenL+Shunt], 0) )
- x4 = x1[1] and close < open and higherhigh0
- x2 = high >= highest(high,120)
- x3 = x2[1]
- x = x4 and x3
- //plotshape(x, text="Double Top", title='Double Top', style=shape.labeldown, color=red, textcolor=white, location=location.abovebar, transp=0)
- /////
- recent_x=na
- for i=0 to (pvtLenR+3)
- recent_x:=x[i]
- if recent_x==true
- break
- pl_col=recent_x?black:na
- plot(ph,linewidth=4,color=pl_col,offset=-pvtLenL)
- /////
- dub_btm=x and not recent_x[1]
- //plotshape(dub_btm, text="Double Bottom", title='Double Bottom', style=shape.labelup, color=green, textcolor=white, location=location.belowbar, transp=0)
- plotshape(dub_btm, text="Double Top", title='Double Top', style=shape.labeldown, color=red, textcolor=white, location=location.abovebar, transp=0)
Advertisement
Add Comment
Please, Sign In to add comment