xmd79

VisionVolume

Jan 17th, 2022
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. // © Hookster
  2. //@version=5
  3. indicator(title='VisionVolume', shorttitle='VisVol', overlay=true)
  4. showLabels = input(true)
  5. weakpush = input(title='Weak push', defval=#9e32f9)
  6. resistance = input(title='Resistance', defval=color.orange)
  7.  
  8. //average vol
  9. vcal(Series, Period) =>
  10. mean = math.sum(Series, Period) / Period
  11. return_1 = mean
  12. return_1
  13.  
  14. avgV = vcal(volume, 200)
  15. medVlower = avgV > volume
  16. medVhigher = avgV < volume
  17.  
  18. //bar heights
  19. barH2 = high[2] - low[2]
  20. barH1 = high[1] - low[1]
  21. barH0 = high - low
  22.  
  23. isUp() =>
  24. close > open
  25. isUp1() =>
  26. close[1] > open[1]
  27. isUp2() =>
  28. close[2] > open[2]
  29. isDown() =>
  30. close <= open
  31. isDown1() =>
  32. close[1] <= open[1]
  33. isDown2() =>
  34. close[2] <= open[2]
  35.  
  36. //INDICATOR 1 - weak push higher or lower
  37. higherPA() =>
  38. barH1 * 1.1 < barH0
  39. sameDirection = isUp() == isUp1()
  40. lowerV() =>
  41. volume[0] < volume[1] * 0.9
  42. ind1 = higherPA() and lowerV() and sameDirection and medVlower
  43.  
  44. //confirmation
  45. //lower than avg
  46.  
  47. secondlowerV() =>
  48. volume[0] < volume[2]
  49. ind1b = ind1[1] and secondlowerV() and sameDirection
  50.  
  51. //COLOR IND 1//
  52. barcolor(ind1 ? weakpush : na)
  53. barcolor(ind1b ? color.black : na)
  54.  
  55. pushUp = ind1 and isUp() and showLabels
  56. pushDown = ind1 and isDown() and showLabels
  57. plotshape(pushDown, title='buy', text='Fake! ⬆︎', color=weakpush, style=shape.labelup, location=location.belowbar, size=size.small, textcolor=color.new(color.white, 0), transp=0) //plot for buy icon
  58. plotshape(pushUp, title='sell', text='Fake! ⬇︎', color=weakpush, style=shape.labeldown, location=location.abovebar, size=size.small, textcolor=color.new(color.white, 0), transp=0)
  59. // Alert //
  60. alertcondition(pushDown, title='pushDown', message='Buy')
  61. alertcondition(pushUp, title='pushUp', message='Sell')
  62.  
  63. //INDICATOR 2 - Rally that meets resistance by high volume - low price action
  64. lowerPA() =>
  65. barH1 > barH0
  66. higherV() =>
  67. volume[0] > volume[1]
  68. ind2 = lowerPA() and higherV() and sameDirection and medVhigher
  69. //COLOR IND 2//
  70. barcolor(ind2 ? resistance : na)
  71.  
  72. resistUp = ind2 and isUp() and showLabels
  73. resistDown = ind2 and isDown() and showLabels
  74. plotshape(resistDown, title='buy', text='Reversal ⬆︎', color=resistance, style=shape.labelup, location=location.belowbar, size=size.small, textcolor=color.new(color.white, 0), transp=0) //plot for buy icon
  75. plotshape(resistUp, title='sell', text='Reversal ⬇︎', color=resistance, style=shape.labeldown, location=location.abovebar, size=size.small, textcolor=color.new(color.white, 0), transp=0)
  76. // Alert //
  77. alertcondition(resistDown, title='resistDown', message='Buy')
  78. alertcondition(resistUp, title='resistUp', message='Sell')
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
Advertisement
Add Comment
Please, Sign In to add comment