AnthonyAlexander

DT Pattern-4/5 completed

Jan 4th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. //@version=3
  2. study("Double Top Pattern", overlay=true)
  3. //length = input(15,title="length")
  4. //pvtLenL = length
  5. //pvtLenR = length
  6. //pl = pivotlow(pvtLenL, pvtLenR)
  7. //WaitForClose = input(true)
  8. //pvtlo_ = pivotlow(low, pvtLenL, pvtLenR)
  9. //Shunt = WaitForClose ? 1 : 0
  10. //pvtlo = pvtlo_[Shunt]
  11. //lowerlow0 = ( valuewhen(pvtlo, low[pvtLenR+Shunt], 1) > valuewhen(pvtlo, low[pvtLenR+Shunt], 0) )
  12. //x1 = crossunder(close,valuewhen(pvtlo, low[pvtLenR+Shunt], 0) )
  13. //x = x1[1] and lowerlow0 and close > open
  14. //x2 = low <= lowest(low,120)
  15. //x3 = x2[1]
  16. /////
  17. length = input(10,title="length")
  18. pvtLenL = length
  19. pvtLenR = length
  20. ph = pivothigh(pvtLenR, pvtLenL)
  21. WaitForClose = input(true)
  22. pvthi_ = pivothigh(high, pvtLenR, pvtLenL)
  23. Shunt = WaitForClose ? 1 : 0
  24. pvthi = pvthi_[Shunt]
  25.  
  26. higherhigh0 = ( valuewhen(pvthi, high[pvtLenR+Shunt], 1) > valuewhen(pvthi, high[pvtLenR+Shunt], 0) )
  27.  
  28.  
  29. x1 = crossover(close,valuewhen(pvthi, high[pvtLenL+Shunt], 0) )
  30. x4 = x1[1] and close < open and higherhigh0
  31.  
  32. x2 = high >= highest(high,120)
  33. x3 = x2[1]
  34. x = x4 and x3
  35.  
  36. //plotshape(x, text="Double Top", title='Double Top', style=shape.labeldown, color=red, textcolor=white, location=location.abovebar, transp=0)
  37.  
  38.  
  39.  
  40. /////
  41. recent_x=na
  42. for i=0 to (pvtLenR+3)
  43. recent_x:=x[i]
  44. if recent_x==true
  45. break
  46. pl_col=recent_x?black:na
  47.  
  48.  
  49. plot(ph,linewidth=4,color=pl_col,offset=-pvtLenL)
  50. /////
  51.  
  52. dub_btm=x and not recent_x[1]
  53.  
  54. //plotshape(dub_btm, text="Double Bottom", title='Double Bottom', style=shape.labelup, color=green, textcolor=white, location=location.belowbar, transp=0)
  55.  
  56. 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