Advertisement
Nick42_for_win

FREE ALGOs [EasyAlgo V2]

Feb 12th, 2022
6,068
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.39 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 V2]", overlay=true, precision=0, max_labels_count=500)
  34.  
  35. //----------------- EasyAlgo V2 | https://www.easyalgo.io --------------------//
  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.int(3, "Volatility Sensitivity (1-3 Hi to Lo)", 1, 3)
  41. signals = input.bool(true, "BUY/SELL Signals?")
  42. levels = input.bool(false, "TP/SL Levels?")
  43. atrLen = input.int(14, "ATR Length", 1)
  44. atrRisk = input.int(2, "ATR/ Risk", 1)
  45. volBandsSen = input.int(5, "Vol Bands Sensitivity (Default: 5.0)", 1)
  46. useEma = input.bool(true, "Use Exponential MA?")
  47. // Get Components
  48. ema1 = ta.ema(ohlc4, 5*volSen)
  49. ema2 = ta.ema(ohlc4, 9*volSen)
  50. ema3 = ta.ema(ohlc4, 13*volSen)
  51. ema4 = ta.ema(ohlc4, 34*volSen)
  52. ema5 = ta.ema(ohlc4, 50*volSen)
  53. f_kc(src, len, mult) =>
  54. float basis = useEma ? ta.ema(src, len) : ta.sma(src, len)
  55. float span = useEma ? ta.ema(ta.tr, len) : ta.sma(ta.tr, len)
  56. [basis + span * mult, basis - span * mult]
  57. [upperKC1, lowerKC1] = f_kc(close, 35, 0.5236 * volBandsSen)
  58. [upperKC2, lowerKC2] = f_kc(close, 35, 0.6854 * volBandsSen)
  59. [upperKC3, lowerKC3] = f_kc(close, 35, 0.8472 * volBandsSen)
  60. bull = ema3 >= ema3[1] and ema1 >= ema2 and ema1[1] < ema2[1]
  61. bear = ema3 <= ema3[1] and ema1 <= ema2 and ema1[1] > ema2[1]
  62. trigger = bull ? 1 : 0
  63. atrBand = ta.atr(atrLen) * atrRisk
  64. atrStop = trigger == 1 ? low - atrBand : high + atrBand
  65. // Colors
  66. green = emaCloud ? #00CC00 : na, green5 = volCloud ? color.new(#00CC00, 95) : na, green12_5 = volCloud ? color.new(#00CC00, 87.5) : na, green20 = volCloud ? color.new(#00CC00, 80) : na
  67. red = emaCloud ? #CC0000 : na, red5 = volCloud ? color.new(#CC0000, 95) : na, red12_5 = volCloud ? color.new(#CC0000, 87.5) : na, red20 = volCloud ? color.new(#CC0000, 80) : na
  68. 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
  69. // Plots
  70. p1 = plot(ema1, "", na, editable=false)
  71. p2 = plot(ema2, "", na, editable=false)
  72. p3 = plot(ema3, "", na, editable=false)
  73. p4 = plot(ema4, "", na, editable=false)
  74. p5 = plot(ema5, "", na, editable=false)
  75. fill(p4, p5, ema4 >= ema5 ? green5 : red5)
  76. fill(p3, p4, ema3 >= ema4 ? green12_5 : red12_5)
  77. fill(p2, p3, ema3 >= ema3[1] ? green : red)
  78. fill(p1, p2, ema1 >= ema3 ? green20 : red20)
  79. barcolor(ema3 >= ema3[1] ? green : red)
  80. b1 = plot(upperKC1, "", gray40, editable=false)
  81. b2 = plot(upperKC2, "", gray40, editable=false)
  82. b3 = plot(upperKC3, "", gray40, editable=false)
  83. b4 = plot(lowerKC1, "", gray40, editable=false)
  84. b5 = plot(lowerKC2, "", gray40, editable=false)
  85. b6 = plot(lowerKC3, "", gray40, editable=false)
  86. fill(b1, b2, gray5)
  87. fill(b2, b3, gray20)
  88. fill(b4, b5, gray5)
  89. fill(b5, b6, gray20)
  90. y1 = low - (ta.atr(30) * 1.6)
  91. y2 = high + (ta.atr(30) * 1.6)
  92. buy = signals and bull ? label.new(bar_index, y1, "BUY", xloc.bar_index, yloc.price, #00CC00, label.style_label_up, color.white, size.normal) : na
  93. sell = signals and bear ? label.new(bar_index, y2, "SELL", xloc.bar_index, yloc.price, #CC0000, label.style_label_down, color.white, size.normal) : na
  94. 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)
  95. entry = levels ? label.new(time, close, "ENTRY " + str.tostring(lastTrade(close), "#.##"), xloc.bar_time, yloc.price, color.gray, label.style_label_left, color.white, size.normal) : na
  96. label.set_y(entry, lastTrade(close))
  97. label.delete(entry[1])
  98. stop_y = lastTrade(atrStop)
  99. stop = levels ? label.new(time, close, "SL " + str.tostring(stop_y, "#.##"), xloc.bar_time, yloc.price, #CC0000, label.style_label_left, color.white, size.normal) : na
  100. label.set_y(stop, stop_y)
  101. label.delete(stop[1])
  102. tp1_y = (lastTrade(close)-lastTrade(atrStop))*1 + lastTrade(close)
  103. tp1 = levels ? label.new(time, close, "1:1 TP " + str.tostring(tp1_y, "#.##"), xloc.bar_time, yloc.price, #00CC00, label.style_label_left, color.white, size.normal) : na
  104. label.set_y(tp1, tp1_y)
  105. label.delete(tp1[1])
  106. tp2_y = (lastTrade(close)-lastTrade(atrStop))*2 + lastTrade(close)
  107. tp2 = levels ? label.new(time, close, "2:1 TP " + str.tostring(tp2_y, "#.##"), xloc.bar_time, yloc.price, #00CC00, label.style_label_left, color.white, size.normal) : na
  108. label.set_y(tp2, tp2_y)
  109. label.delete(tp2[1])
  110. tp3_y = (lastTrade(close)-lastTrade(atrStop))*3 + lastTrade(close)
  111. tp3 = levels ? label.new(time, close, "3:1 TP " + str.tostring(tp3_y, "#.##"), xloc.bar_time, yloc.price, #00CC00, label.style_label_left, color.white, size.normal) : na
  112. label.set_y(tp3, tp3_y)
  113. label.delete(tp3[1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement