Advertisement
Nick42_for_win

FREE ALGOs [EasyAlgo Community 1.0]

Feb 18th, 2022
4,600
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.77 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 from scratch 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 95% 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 [EasyAlgo Community 1.0]", overlay=true, precision=0, explicit_plot_zorder=true, max_labels_count=500)
  34.  
  35. //---------- EasyAlgo Community | https://www.youtube.com/channel/UC-xHWMvMFo1W_GSJ0kqEMvA ----------//
  36. // Get user input
  37. emaCloud = input.bool(true, "EMA Cloud?")
  38. volCloud = input.bool(false, "Volatility Cloud?")
  39. volBands = input.bool(false, "Volatility Bands?")
  40. volSen = input.float(1.5, "Volatility Sensitivity (1-5 (Half Allowed))", 0.5, 5, 0.5)
  41. signals = input.bool(true, "Buy/Sell Signals?")
  42. levels = input.bool(false, "TP/SL Levels?  ", inline="levels")
  43. lvlLines = input.bool(false, "Show Lines? ", inline="levels")
  44. linesStyle = input.string("SOLID", "", ["SOLID", "DASHED", "DOTTED"], inline="levels")
  45. lvlDistance = input.int(1, "Distance", 1, inline="levels2")
  46. lvlDecimals = input.int(2, "   Decimals", 1, 8, inline="levels2")
  47. suppRes = input.bool(false, "Support/Resistance?")
  48. atrLen = input.int(14, "ATR Length", 1)
  49. atrRisk = input.int(2, "ATR/ Risk", 1)
  50. candlesT = input.bool(true, "Trending Candles")
  51. volBandsSen = input.int(5, "Vol Bands Sensitivity (Default: 5.0)", 1)
  52. useEma = input.bool(true, "Use Exponential MA?")
  53. barsLR = input.int(35, "S/R Looking Period", 1)
  54. // Get Components
  55. ema1 = ta.ema(ohlc4, int(5*volSen*2))
  56. ema2 = ta.ema(ohlc4, int(9*volSen*2))
  57. ema3 = ta.ema(ohlc4, int(13*volSen*2))
  58. ema4 = ta.ema(ohlc4, int(34*volSen*2))
  59. ema5 = ta.ema(ohlc4, int(50*volSen*2))
  60. f_kc(src, len, mult) =>
  61. float basis = useEma ? ta.ema(src, len) : ta.sma(src, len)
  62. float span = useEma ? ta.ema(ta.tr, len) : ta.sma(ta.tr, len)
  63. [basis + span * mult, basis - span * mult]
  64. [upperKC1, lowerKC1] = f_kc(close, 35, 0.5236 * volBandsSen)
  65. [upperKC2, lowerKC2] = f_kc(close, 35, 0.6854 * volBandsSen)
  66. [upperKC3, lowerKC3] = f_kc(close, 35, 0.8472 * volBandsSen)
  67. bull = ema3 >= ema3[1] and ema1 >= ema2 and ema1[1] < ema2[1]
  68. bear = ema3 <= ema3[1] and ema1 <= ema2 and ema1[1] > ema2[1]
  69. countBull = ta.barssince(bull)
  70. countBear = ta.barssince(bear)
  71. trigger = bull ? 1 : 0
  72. atrBand = ta.atr(atrLen) * atrRisk
  73. atrStop = trigger == 1 ? low - atrBand : high + atrBand
  74. barsL = barsLR
  75. barsR = barsLR
  76. pivotHigh = fixnan(ta.pivothigh(barsL, barsR)[1])
  77. pivotLow = fixnan(ta.pivotlow(barsL, barsR)[1])
  78. decimals = lvlDecimals == 1 ? "#.#" : lvlDecimals == 2 ? "#.##" : lvlDecimals == 3 ? "#.###" : lvlDecimals == 4 ? "#.####" : lvlDecimals == 5 ? "#.#####" : lvlDecimals == 6 ? "#.######" : lvlDecimals == 7 ? "#.#######" : "#.########"
  79. // Colors
  80. green = #00CC00 , green5 = volCloud ? color.new(#00CC00, 95) : na, green12_5 = volCloud ? color.new(#00CC00, 87.5) : na, green20 = emaCloud ? color.new(#00CC00, 80) : na
  81. red = #CC0000 , red5 = volCloud ? color.new(#CC0000, 95) : na, red12_5 = volCloud ? color.new(#CC0000, 87.5) : na, red20 = emaCloud? color.new(#CC0000, 80) : na
  82. orange = #FF9800 , orange50 = emaCloud ? color.new(orange, 50) : na
  83. gray = volBands ? #787B86 : na, gray40 = volBands ? color.new(gray, 60) : na, gray5 = volBands ? color.new(gray, 95) : na, gray20 = volBands ? color.new(gray, 80) : na
  84. // Plots
  85. p1 = plot(ema1, "", orange50, editable=false)
  86. p2 = plot(ema2, "", orange50, editable=false)
  87. p3 = plot(ema3, "", orange50, editable=false)
  88. p4 = plot(ema4, "", na, editable=false)
  89. p5 = plot(ema5, "", na, editable=false)
  90. fill(p4, p5, ema4 >= ema5 ? green5 : red5)
  91. fill(p3, p4, ema3 >= ema4 ? green12_5 : red12_5)
  92. fill(p2, p3, ema3 >= ema3[1] ? green20 : red20)
  93. fill(p1, p2, ema1 >= ema3 ? green20 : red20)
  94. barcolor(candlesT ? (ema3 >= ema3[1] ? green : red) : na)
  95. b1 = plot(upperKC1, "", gray40, editable=false)
  96. b2 = plot(upperKC2, "", gray40, editable=false)
  97. b3 = plot(upperKC3, "", gray40, editable=false)
  98. b4 = plot(lowerKC1, "", gray40, editable=false)
  99. b5 = plot(lowerKC2, "", gray40, editable=false)
  100. b6 = plot(lowerKC3, "", gray40, editable=false)
  101. fill(b1, b2, gray5)
  102. fill(b2, b3, gray20)
  103. fill(b4, b5, gray5)
  104. fill(b5, b6, gray20)
  105. plot(pivotHigh, "Resistance", not suppRes or ta.change(pivotHigh) ? na : red, 3, offset=-(barsR + 1), editable=false)
  106. plot(pivotLow, "Support", not suppRes or ta.change(pivotLow) ? na : green, 3, offset=-(barsR + 1), editable=false)
  107. y1 = low - (ta.atr(30) * 1.6)
  108. y2 = high + (ta.atr(30) * 1.6)
  109. buy = signals and bull ? label.new(bar_index, y1, ema4 >= ema5 ? "FIRM BUY" : "BUY", xloc.bar_index, yloc.price, #00CC00, label.style_label_up, #141923, size.normal) : na
  110. sell = signals and bear ? label.new(bar_index, y2, ema4 <= ema5 ? "FIRM SELL" : "SELL", xloc.bar_index, yloc.price, #CC0000, label.style_label_down, color.white, size.normal) : na
  111. lastTrade(src) => ta.valuewhen((ema3 >= ema3[1] and ema1 >= ema2 and ema1[1] < ema2[1]) or (ema3 <= ema3[1] and ema1 <= ema2 and ema1[1] > ema2[1]), src, 0)
  112. entry = levels ? label.new(time, close, "ENTRY " + str.tostring(lastTrade(close), decimals), xloc.bar_time, yloc.price, color.gray, label.style_label_left, color.white, size.normal) : na
  113. label.set_x(entry, label.get_x(entry) + math.round(ta.change(time) * lvlDistance))
  114. label.set_y(entry, lastTrade(close))
  115. label.delete(entry[1])
  116. stop_y = lastTrade(atrStop)
  117. stop = levels ? label.new(time, close, "SL " + str.tostring(stop_y, decimals), xloc.bar_time, yloc.price, #CC0000, label.style_label_left, color.white, size.normal) : na
  118. label.set_x(stop, label.get_x(stop) + math.round(ta.change(time) * lvlDistance))
  119. label.set_y(stop, stop_y)
  120. label.delete(stop[1])
  121. tp1_y = (lastTrade(close)-lastTrade(atrStop))*1 + lastTrade(close)
  122. tp1 = levels ? label.new(time, close, "1:1 TP " + str.tostring(tp1_y, decimals), xloc.bar_time, yloc.price, #00CC00, label.style_label_left, color.white, size.normal) : na
  123. label.set_x(tp1, label.get_x(tp1) + math.round(ta.change(time) * lvlDistance))
  124. label.set_y(tp1, tp1_y)
  125. label.delete(tp1[1])
  126. tp2_y = (lastTrade(close)-lastTrade(atrStop))*2 + lastTrade(close)
  127. tp2 = levels ? label.new(time, close, "2:1 TP " + str.tostring(tp2_y, decimals), xloc.bar_time, yloc.price, #00CC00, label.style_label_left, color.white, size.normal) : na
  128. label.set_x(tp2, label.get_x(tp2) + math.round(ta.change(time) * lvlDistance))
  129. label.set_y(tp2, tp2_y)
  130. label.delete(tp2[1])
  131. tp3_y = (lastTrade(close)-lastTrade(atrStop))*3 + lastTrade(close)
  132. tp3 = levels ? label.new(time, close, "3:1 TP " + str.tostring(tp3_y, decimals), xloc.bar_time, yloc.price, #00CC00, label.style_label_left, color.white, size.normal) : na
  133. label.set_x(tp3, label.get_x(tp3) + math.round(ta.change(time) * lvlDistance))
  134. label.set_y(tp3, tp3_y)
  135. label.delete(tp3[1])
  136. style = linesStyle == "SOLID" ? line.style_solid : linesStyle == "DASHED" ? line.style_dashed : line.style_dotted
  137. lineEntry = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), lastTrade(close), bar_index + lvlDistance, lastTrade(close), xloc.bar_index, extend.none, color.gray, style, 2) : na, line.delete(lineEntry[1])
  138. lineStop = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), stop_y, bar_index + lvlDistance, stop_y, xloc.bar_index, extend.none, #CC0000, style, 2) : na, line.delete(lineStop[1])
  139. lineTp1 = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), tp1_y, bar_index + lvlDistance, tp1_y, xloc.bar_index, extend.none, #00CC00, style, 2) : na, line.delete(lineTp1[1])
  140. lineTp2 = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), tp2_y, bar_index + lvlDistance, tp2_y, xloc.bar_index, extend.none, #00CC00, style, 2) : na, line.delete(lineTp2[1])
  141. lineTp3 = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), tp3_y, bar_index + lvlDistance, tp3_y, xloc.bar_index, extend.none, #00CC00, style, 2) : na, line.delete(lineTp3[1])
  142. // Alerts
  143. alertcondition(bull, "Buy", "EasyAlgo Community\nBuy {{ticker}} @ {{close}}")
  144. alertcondition(bull and ema4 >= ema5, "Firm Buy", "EasyAlgo Community\nFirm Buy {{ticker}} @ {{close}}")
  145. alertcondition(bear and ema4 <= ema5, "Firm Sell", "EasyAlgo Community\nFirm Sell {{ticker}} @ {{close}}")
  146. alertcondition(bear, "Sell", "EasyAlgo Community\nSell {{ticker}} @ {{close}}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement