Advertisement
Nick42_for_win

FREE ALGOs [AI Signals Platinum]

Feb 13th, 2022
5,686
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.07 KB | None | 0 0
  1. // 8888888888 8888888b. 8888888888 8888888888 d8888 888 .d8888b. .d88888b. As you
  2. // 888 888 Y88b 888 888 d88888 888 d88P Y88b d88P" "Y88b Can see
  3. // 888 888 888 888 888 d88P888 888 888 888 888 888 Are all
  4. // 8888888 888 d88P 8888888 8888888 d88P 888 888 888 888 888 .d8888b Basic free
  5. // 888 8888888P" 888 888 d88P 888 888 888 88888 888 888 88K tradingview
  6. // 888 888 T88b 888 888 d88P 888 888 888 888 888 888 "Y8888b. indicators
  7. // 888 888 T88b 888 888 d8888888888 888 Y88b d88P Y88b. .d88P X88 repackaged
  8. // 888 888 T88b 8888888888 8888888888 d88P 888 88888888 "Y8888P88 "Y88888P" 88888P' into one
  9. //
  10. // FAQ
  11. //
  12. // Why?
  13. // I want you to see what you are willing to pay hundereds of dollars a month
  14.  
  15. // Has the code been leaked/hacked?
  16. // No, this code has been created only using common sense and public information from the internet
  17.  
  18. // What's the accuracy I can expect from this version of the indicator?
  19. // I'd say it's about 90% the same as the one you would pay
  20.  
  21. // The indicator needs to be updated?
  22. // Write me a private message on TradingView (Nick42_for_win)
  23.  
  24. // Can I suggest an indicator to get a FREE ALGOs version?
  25. // Write me a private message on TradingView (Nick42_for_win)
  26.  
  27. // Do you get any monetary return from this project?
  28. // Nope, 0$
  29.  
  30. // Enjoy ;)
  31.  
  32. //@version=5
  33. indicator("FREE ALGOs [AI Signals Platinum]", overlay=true, precision=0, explicit_plot_zorder=true, max_labels_count=500)
  34.  
  35. //------------------ AI Signals | https://www.getaisignals.com ---------------//
  36. // Get user input
  37. sensitivity = input.string("Low", "Sensitivity", ["Low", "Medium", "High"])
  38. suppRes = input.bool(false, "Support & Resistance")
  39. breaks = input.bool(false, "Breaks")
  40. usePsar = input.bool(false, "PSAR")
  41. emaEnergy = input.bool(true, "EMA Energy")
  42. channelBal = input.bool(true, "Channel Balance")
  43. autoTL = input.bool(false, "Auto Trend Lines")
  44. // Functions
  45. supertrend(_src, factor, atrLen) =>
  46. atr = ta.atr(atrLen)
  47. upperBand = _src + factor * atr
  48. lowerBand = _src - factor * atr
  49. prevLowerBand = nz(lowerBand[1])
  50. prevUpperBand = nz(upperBand[1])
  51. lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ? lowerBand : prevLowerBand
  52. upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ? upperBand : prevUpperBand
  53. int direction = na
  54. float superTrend = na
  55. prevSuperTrend = superTrend[1]
  56. if na(atr[1])
  57. direction := 1
  58. else if prevSuperTrend == prevUpperBand
  59. direction := close > upperBand ? -1 : 1
  60. else
  61. direction := close < lowerBand ? 1 : -1
  62. superTrend := direction == -1 ? lowerBand : upperBand
  63. [superTrend, direction]
  64. lr_slope(_src, _len) =>
  65. x = 0.0, y = 0.0, x2 = 0.0, xy = 0.0
  66. for i = 0 to _len - 1
  67. val = _src[i]
  68. per = i + 1
  69. x += per
  70. y += val
  71. x2 += per * per
  72. xy += val * per
  73. _slp = (_len * xy - x * y) / (_len * x2 - x * x)
  74. _avg = y / _len
  75. _int = _avg - _slp * x / _len + _slp
  76. [_slp, _avg, _int]
  77. lr_dev(_src, _len, _slp, _avg, _int) =>
  78. upDev = 0.0, dnDev = 0.0
  79. val = _int
  80. for j = 0 to _len - 1
  81. price = high[j] - val
  82. if price > upDev
  83. upDev := price
  84. price := val - low[j]
  85. if price > dnDev
  86. dnDev := price
  87. price := _src[j]
  88. val += _slp
  89. [upDev, dnDev]
  90. // Get Components
  91. ocAvg = math.avg(open, close)
  92. sma1 = ta.sma(close, 5)
  93. sma2 = ta.sma(close, 6)
  94. sma3 = ta.sma(close, 7)
  95. sma4 = ta.sma(close, 8)
  96. sma5 = ta.sma(close, 9)
  97. sma6 = ta.sma(close, 10)
  98. sma7 = ta.sma(close, 11)
  99. sma8 = ta.sma(close, 12)
  100. sma9 = ta.sma(close, 13)
  101. sma10 = ta.sma(close, 14)
  102. sma11 = ta.sma(close, 15)
  103. sma12 = ta.sma(close, 16)
  104. sma13 = ta.sma(close, 17)
  105. sma14 = ta.sma(close, 18)
  106. sma15 = ta.sma(close, 19)
  107. sma16 = ta.sma(close, 20)
  108. psar = ta.sar(0.02, 0.02, 0.2)
  109. [middleKC1, upperKC1, lowerKC1] = ta.kc(close, 80, 10.5)
  110. [middleKC2, upperKC2, lowerKC2] = ta.kc(close, 80, 9.5)
  111. [middleKC3, upperKC3, lowerKC3] = ta.kc(close, 80, 8)
  112. [middleKC4, upperKC4, lowerKC4] = ta.kc(close, 80, 3)
  113. [supertrend, direction] = supertrend(close, sensitivity == "Low" ? 5 : sensitivity == "Medium" ? 2.5 : 2, 11)
  114. barsL = 10
  115. barsR = 10
  116. pivotHigh = fixnan(ta.pivothigh(barsL, barsR)[1])
  117. pivotLow = fixnan(ta.pivotlow(barsL, barsR)[1])
  118. source = close, period = 150
  119. [s, a, i] = lr_slope(source, period)
  120. [upDev, dnDev] = lr_dev(source, period, s, a, i)
  121. // Colors
  122. green = #2BBC4D, green2 = #00DD00
  123. red = #C51D0B, red2 = #DD0000
  124. emaEnergyColor(ma) => emaEnergy ? (close >= ma ? green : red) : na
  125. // Plots
  126. k1 = plot(ta.ema(upperKC1, 50), "", na, editable=false)
  127. k2 = plot(ta.ema(upperKC2, 50), "", na, editable=false)
  128. k3 = plot(ta.ema(upperKC3, 50), "", na, editable=false)
  129. k4 = plot(ta.ema(upperKC4, 50), "", na, editable=false)
  130. k5 = plot(ta.ema(lowerKC4, 50), "", na, editable=false)
  131. k6 = plot(ta.ema(lowerKC3, 50), "", na, editable=false)
  132. k7 = plot(ta.ema(lowerKC2, 50), "", na, editable=false)
  133. k8 = plot(ta.ema(lowerKC1, 50), "", na, editable=false)
  134. fill(k1, k2, channelBal ? color.new(red2, 40) : na, editable=false)
  135. fill(k2, k3, channelBal ? color.new(red2, 65) : na, editable=false)
  136. fill(k3, k4, channelBal ? color.new(red2, 90) : na, editable=false)
  137. fill(k5, k6, channelBal ? color.new(green2, 90) : na, editable=false)
  138. fill(k6, k7, channelBal ? color.new(green2, 65) : na, editable=false)
  139. fill(k7, k8, channelBal ? color.new(green2, 40) : na, editable=false)
  140. plot(sma1, "", emaEnergyColor(sma1), editable=false)
  141. plot(sma2, "", emaEnergyColor(sma2), editable=false)
  142. plot(sma3, "", emaEnergyColor(sma3), editable=false)
  143. plot(sma4, "", emaEnergyColor(sma4), editable=false)
  144. plot(sma5, "", emaEnergyColor(sma5), editable=false)
  145. plot(sma6, "", emaEnergyColor(sma6), editable=false)
  146. plot(sma7, "", emaEnergyColor(sma7), editable=false)
  147. plot(sma8, "", emaEnergyColor(sma8), editable=false)
  148. plot(sma9, "", emaEnergyColor(sma9), editable=false)
  149. plot(sma10, "", emaEnergyColor(sma10), editable=false)
  150. plot(sma11, "", emaEnergyColor(sma11), editable=false)
  151. plot(sma12, "", emaEnergyColor(sma12), editable=false)
  152. plot(sma13, "", emaEnergyColor(sma13), editable=false)
  153. plot(sma14, "", emaEnergyColor(sma14), editable=false)
  154. plot(sma15, "", emaEnergyColor(sma15), editable=false)
  155. plot(sma16, "", emaEnergyColor(sma16), editable=false)
  156. barcolor(close > supertrend ? #2BE300 : red2)
  157. p3 = plot(ocAvg, "", na, editable=false)
  158. p4 = plot(psar, "PSAR", usePsar ? (close > psar ? green : red) : na, 1, plot.style_circles, editable=false)
  159. fill(p3, p4, usePsar ? (close > psar ? color.new(green, 90) : color.new(red, 90)) : na, editable=false)
  160. y1 = low - (ta.atr(30) * 2), y1B = low - ta.atr(30)
  161. y2 = high + (ta.atr(30) * 2), y2B = high + ta.atr(30)
  162. bull = ta.crossover(close, supertrend) and close >= sma9
  163. bear = ta.crossunder(close, supertrend) and close <= sma9
  164. buy = bull ? label.new(bar_index, y1, "BUY", xloc.bar_index, yloc.price, #2BE300, label.style_label_up, color.white) : na
  165. sell = bear ? label.new(bar_index, y2, "SELL", xloc.bar_index, yloc.price, red2, label.style_label_down, color.white) : na
  166. plot(pivotHigh, "Resistance", not suppRes or ta.change(pivotHigh) ? na : red, 2, offset=-(barsR + 1), editable=false)
  167. plot(pivotLow, "Support", not suppRes or ta.change(pivotLow) ? na : green, 2, offset=-(barsR + 1), editable=false)
  168. upB = breaks and ta.crossover(close, pivotHigh) ? label.new(bar_index, y1B, "B", xloc.bar_index, yloc.price, green, label.style_label_up, color.white, size.small) : na
  169. dnB = breaks and ta.crossunder(close, pivotLow) ? label.new(bar_index, y2B, "B", xloc.bar_index, yloc.price, red, label.style_label_down, color.white, size.small) : na
  170. x1 = bar_index - period + 1, _y1 = i + s * (period - 1), x2 = bar_index, _y2 = i
  171. upperTL = autoTL ? line.new(x1, _y1 + upDev, x2, _y2 + upDev, xloc.bar_index, extend.none, red) : na
  172. line.delete(upperTL[1])
  173. middleTL = autoTL ? line.new(x1, _y1, x2, _y2, xloc.bar_index, extend.none, color.white) : na
  174. line.delete(middleTL[1])
  175. lowerTL = autoTL ? line.new(x1, _y1 - dnDev, x2, _y2 - dnDev, xloc.bar_index, extend.none, green) : na
  176. line.delete(lowerTL[1])
  177. // Alerts
  178. // alertcondition(bull or bear or ta.crossover(close, pivotHigh) or ta.crossunder(close, pivotLow), "Alert Any", "AI Signals Platinum\nAlert Triggered on {{ticker}} @ {{close}}")
  179. // alertcondition(bull, "Alert Buy", "AI Signals Platinum\nBuy {{ticker}} @ {{close}}")
  180. // alertcondition(bear, "Alert Sell", "AI Signals Platinum\nSell {{ticker}} @ {{close}}")
  181. // alertcondition(ta.crossover(close, pivotHigh), "Broke Resistance", "AI Signals Platinum\nBroke Resistance on {{ticker}} @ {{close}}")
  182. // alertcondition(ta.crossunder(close, pivotLow), "Broke Support", "AI Signals Platinum\nBroke Support on {{ticker}} @ {{close}}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement