daily pastebin goal
13%
SHARE
TWEET

awesome_squid_v3

a guest May 23rd, 2018 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //@version=3
  2. //Awsome Squid Indicator2
  3. //by Sgjoe123
  4. //All creding goes to LazyBear for TTM, Woody for CCI and LazyBear, xSilas, Ni6HTH4wK, sco77m4r7in, oh92 for GodMode
  5. //Indicators originally combined by BlankSpaceisBlank, Sgjoe123 recoded TTM added Divergence function vertical lines.
  6. //Added slower god mode settings and VIX Fix for finding bottoms by themnis.
  7.  
  8. study("Awsome Squid Indicator")
  9.  
  10.  
  11. //Woody CCI///////////////////////////////////////////////////////////////////////////////////////////
  12.  
  13.  
  14. cci14Length = input(title="CCI 14 Length", type=integer, defval=14, minval=7, maxval=14)
  15. cci50Length = input(title="CCI 50 Length", type=integer, defval=50, minval=20, maxval=50)
  16.  
  17. src = input(close, title="Source")
  18.  
  19. cciTurbo = cci(src, cci14Length)
  20. cci14 = cci(src, cci50Length)
  21.  
  22. last5IsDown = cci14 < -100
  23. last5IsZero = cci14 >= -100 and cci14 <= 100
  24. last5IsUp = cci14 > 100
  25. histogramColor = last5IsUp ? color(#00FA9A, 70) : last5IsDown ? color(#1E90FF, 70) : last5IsZero ? color(yellow, 80) : color(aqua, 70)
  26. LineColor = last5IsUp ? color(#00FA9A, 70) : last5IsDown ? color(#1E90FF, 70) : last5IsZero ? color(yellow, 80) : color(aqua, 70)
  27.  
  28. cciTurboIsDown = cciTurbo < -100
  29. cciTurboIsZero = cciTurbo >= -100 and cciTurbo <= 100
  30. cciTurboIsUp = cciTurbo > 100
  31. LineColorTurbo = cciTurboIsUp ? color(lime, 10) : cciTurboIsDown ? color(#1E90FF, 1) : cciTurboIsZero ? color(yellow, 10) : cciTurbo < 0 ? color(aqua, 10) : color(aqua, 10)
  32.  
  33. plot(cci14, title="CCI 50 Histogram", color=histogramColor, style=area)
  34. plot(cci14, title="CCI 50", color=LineColor, style=linebr, linewidth=2)
  35. plot(cciTurbo, title="CCI 14", color=LineColorTurbo, style=linebr, linewidth=2)
  36.  
  37. hline(100, title="Hundred Line", color=color(#00CED1, 10), linestyle=dashed)
  38. hline(-100, title="Minus Line", color=color(#00CED1, 10), linestyle=dashed)
  39.  
  40.  
  41. //TTM///////////////////////////////////////////////////////////////////////////////////////////////////////////
  42.  
  43. length = input(title="TTM Length", type=integer, defval=20, minval=0)
  44. bband(length, mult) =>
  45.     sma(close, length) + mult * stdev(close, length)
  46. keltner(length, mult) =>
  47.     ema(close, length) + mult * ema(tr, length)
  48.  
  49. e1 = (highest(high, length) + lowest(low, length)) / 2 + sma(close, length)
  50. osc = linreg(close - e1 / 2, length, 0)
  51. diff = bband(length, 2) - keltner(length, 1)
  52. osc_color = osc[1] < osc[0] ? osc[0] >= 0 ? #08fd1e : #8bff95 : osc[0] >= 0 ? #ff1010 : #ff7575
  53. mid_color = diff >= 0 ? na : red
  54.  
  55. plot(osc, title = "TTM Histogram", color=osc_color, style=histogram, linewidth=1)
  56. plot(0, title = "TTM Squeezes", color=mid_color, style=circles, linewidth=2)
  57.  
  58. //GODMODE//////////////////////////////////////////////////////////////////////////////////////////////////////
  59.  
  60.  
  61. //study(shorttitle = "SQZMOM_LB", title="Squeeze Momentum Indicator [LazyBear]", overlay=false)
  62. fastn1 = input(17, "Channel Length")
  63. fastn2 = input(6, "Average Length")
  64. fastn3 = input(4, "Short Length")
  65. enableSecond = input(type = bool, defval = true, title = "Enable Second Godmode Indicator")
  66. slown1 = input(9, "Slow Channel Length")
  67. slown2 = input(26, "Slow Average Length")
  68. slown3 = input(13, "Slow Short Length")
  69. multi = input(type=bool, defval=false, title="Multi-exchange?")
  70. src0 = hlc3
  71.  
  72.  
  73. tci(src, n1, n2) => ema((src - ema(src, n1)) / (0.025 * ema(abs(src - ema(src, n1)), n1)), n2)+50
  74. mf(src, n3) => rsi(sum(volume * (change(src) <= 0 ? 0 : src), n3), sum(volume * (change(src) >= 0 ? 0 : src), n3))
  75. willy(src, n2) => 60 * (src - highest(src, n2)) / (highest(src, n2) - lowest(src, n2)) + 80
  76. csi(src, n1, n2, n3) => avg(rsi(src, n3),tsi(src0,n1,n2)*50+50)
  77.  
  78. godmode(src, n1, n2, n3) => avg(tci(src, n1, n2), csi(src, n1, n2, n3), mf(src, n3), willy(src, n2))
  79. tradition(src, n1, n2, n3) => avg(tci(src, n1, n2), mf(src, n3),rsi(src, n3))
  80. extended(wt2) => wt2 < 20 ? wt2 + 5 : wt2 > 80 ? wt2 - 5 : na
  81.  
  82.  
  83. fastwt1 = godmode(src0, fastn1, fastn2, fastn3)
  84. fastwt2 = sma(fastwt1,6)
  85. slowwt1 = godmode(src0, slown1, slown2, slown3)
  86. slowwt2 = sma(slowwt1, 6)
  87.  
  88. fastextended = fastwt2 < 20 ? fastwt2 + 5 : fastwt2 > 80 ? fastwt2 - 5 : na
  89. slowextended = extended(slowwt2)
  90.  
  91. plot(fastextended < 50 ? -350 : fastextended > 50 ? 350 : na, title="Godemode Caution!", color = yellow, transp = 0, style=circles, linewidth=2)
  92. plot(slowextended < 50 ? -300 : slowextended > 50 ? 300 : na, title = "Godemode Extreme Caution!", color = red, transp = 0, style = circles, linewidth = 2)
  93.  
  94.  
  95.  
  96. // <========== RSI Divergence ==========>
  97. osci = rsi(close, 14)
  98.  
  99. // Bullish
  100. bullishPrice = low
  101. priceMins = bullishPrice > bullishPrice[1] and bullishPrice[1] < bullishPrice[2]
  102.  
  103. priceRightMin = valuewhen(priceMins, bullishPrice[1], 0)
  104. priceLeftMin = valuewhen(priceMins, bullishPrice[1], 1)
  105.  
  106. oscRightMin = valuewhen(priceMins, osci[1], 0)
  107. oscLeftMin = valuewhen(priceMins, osci[1], 1)
  108.  
  109. bullishNDiv = priceLeftMin > priceRightMin and oscLeftMin < oscRightMin
  110. bullishHDiv = priceLeftMin < priceRightMin and oscLeftMin > oscRightMin
  111.  
  112. bullishNSig = bullishNDiv and not bullishNDiv[1] and bullishPrice[1] < bullishPrice
  113. bullishHSig = bullishHDiv and not bullishHDiv[1] and bullishPrice[1] > bullishPrice
  114.  
  115. plot(bullishNSig ? -200 : 0, title="Normal Bullish Divergence", style=histogram, linewidth=5, color=green)
  116. plot(bullishHSig ? 200 : 0, title="Hidden Bullish Divergence", style=histogram, linewidth=2, color=green)
  117.  
  118. // Bearish
  119. bearishPrice = high
  120. priceMaxs = bearishPrice < bearishPrice[1] and bearishPrice[1] > bearishPrice[2]
  121.  
  122. priceRightMax = valuewhen(priceMaxs, bearishPrice[1], 0)
  123. priceLeftMax = valuewhen(priceMaxs, bearishPrice[1], 1)
  124.  
  125. oscRightMax = valuewhen(priceMaxs, osci[1], 0)
  126. oscLeftMax = valuewhen(priceMaxs, osci[1], 1)
  127.  
  128. bearishNDiv = priceLeftMax < priceRightMax and oscLeftMax > oscRightMax
  129. bearishHDiv = priceLeftMax > priceRightMax and oscLeftMax < oscRightMax
  130.  
  131. bearishNSig = bearishNDiv and not bearishNDiv[1] and bearishPrice[1] < bearishPrice
  132. bearishHSig = bearishHDiv and not bearishHDiv[1] and bearishPrice[1] > bearishPrice
  133.  
  134. plot(bearishNSig ? -200 : 0, title="Normal Bearish Divergence", style=histogram, linewidth=5, color=red)
  135. plot(bearishHSig ? 200 : 0, title="Hidden Bearish Divergence", style=histogram, linewidth=2, color=red)
  136.  
  137.  
  138. // <========== VIX Fix ==========>
  139. vix = input(false, title="-------VIX Fix Settings-------" )
  140. pd = input(30, title="LookBack Period Standard Deviation High")
  141. bbl = input(20, title="Bolinger Band Length")
  142. mult = input(2.0, minval=1, maxval=5, title="Bollinger Band Standard Devaition Up")
  143. lb = input(50, title="Look Back Period Percentile High")
  144. ph = input(.85, title="Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%")
  145. new3 = input(false, title="Check Below to turn All Bars Gray, Then Check the Boxes Above, And your will have Same Colors As VixFix")
  146. sgb = input(false, title="Check Box To Turn Bars Gray?")
  147. //Criteria for Down Trend Definition for Filtered Pivots and Aggressive Filtered Pivots
  148. ltLB = input(40, minval=25, maxval=99, title="Long-Term Look Back Current Bar Has To Close Below This Value OR Medium Term--Default=40")
  149. mtLB = input(14, minval=10, maxval=20, title="Medium-Term Look Back Current Bar Has To Close Below This Value OR Long Term--Default=14")
  150. str = input(3, minval=1, maxval=9, title="Entry Price Action Strength--Close > X Bars Back---Default=3")
  151.  
  152.  
  153. //Williams Vix Fix Formula
  154. wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
  155. sDev = mult * stdev(wvf, bbl)
  156. midLine = sma(wvf, bbl)
  157. lowerBand = midLine - sDev
  158. upperBand = midLine + sDev
  159. rangeHigh = (highest(wvf, lb)) * ph
  160.  
  161. //Filtered Bar Criteria
  162. upRange = low > low[1] and close > high[1]
  163. upRange_Aggr = close > close[1] and close > open[1]
  164. //Filtered Criteria
  165. filtered = ((wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and (wvf < upperBand and wvf < rangeHigh))
  166. filtered_Aggr = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and not (wvf < upperBand and wvf < rangeHigh)
  167.  
  168. //Alerts Criteria
  169. // alert1 = wvf >= upperBand or wvf >= rangeHigh ? 1 : 0
  170. // alert2 = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and (wvf < upperBand and wvf < rangeHigh) ? 1 : 0
  171. alert3 = upRange and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered ? 1 : 0
  172. alert4 = upRange_Aggr and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered_Aggr ? 1 : 0
  173.  
  174. plot(alert3 ? -400 : na, title="VIX Bottom Safer Entry", style = cross, linewidth=2, color = fuchsia)
  175. plot(alert4 ? -400 : na, title="VIX Bottom Aggressive Entry", style = cross, linewidth = 2, color = orange)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top