Advertisement
Guest User

Untitled

a guest
Sep 8th, 2018
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. //@version=2
  2. study("Leveraged S/R", overlay = true, max_bars_back=2000)
  3.  
  4. //If this indicator made you money or you just appreciate the work put into it, feel free to leave one:
  5. //BTC: 1KHAhAwVd8GeeA1ezovzJmo82ee38TFhiw
  6. //ETH: 0xe26a4381380be19752Af83F6b0b628C412fD53b8
  7.  
  8. //Rules
  9. TKcross10306030 = input(true, title="TK Cross (10, 30, 60, 30)")
  10. TKcross20603060 = input(true, title= "TK Cross(20, 60, 30, 60)")
  11. DeMark = input(true, title ="DeMark")
  12. RSI_BB = input(true, title = "RSI + BB Cross")
  13. Leverage = input(5, title = "Leverage")
  14. src = input(close, title = "Source")
  15.  
  16. //TD
  17. up = src > src[4] ? nz(up[1]) + 1 : 0, tdup = up - valuewhen(up < up[1], up, 0)
  18. dn = src < src[4] ? nz(dn[1]) + 1 : 0, tddn = dn - valuewhen(dn < dn[1], dn, 0)
  19.  
  20. //Ichimoku
  21. d(l) => avg(highest(l), lowest(l))
  22. t = d(10)
  23. t2x = d(20)
  24. k = d(30)
  25. k2x = d(60)
  26.  
  27. //BB
  28. BBp = input(20, title = "BB periods)")
  29. mult = input(2, title = "Multiplier")
  30. basis = sma(src, BBp)
  31. dev = mult * stdev(src, BBp)
  32. upper = basis + dev
  33. lower = basis - dev
  34.  
  35. //RSI
  36. RSIp = input(14, title="RSI periods")
  37. rsi = rsi(close, RSIp)
  38. os = input(30, title="Oversold RSI level")
  39. ob = input(70, title="Overbought RSI level")
  40.  
  41. //Signals
  42. bear_TKx = crossunder(t, k)
  43. bull_TKx = crossover(t, k)
  44. bear_TKx2x = crossunder(t2x, k2x)
  45. bull_TKx2x = crossover(t2x, k2x)
  46. RSIob = rsi > ob
  47. RSIos = rsi < os
  48. BBxup = crossover(src, upper)
  49. BBxdown = crossunder(src, lower)
  50. TDbuysetup = tdup == 9
  51. TDsellsetup = tddn == 9
  52.  
  53. //SR Ichi
  54. IchiLongLiqLevel = src[barssince(bull_TKx)] - (src[barssince(bull_TKx)]/Leverage)
  55. IchiShortLiqLevel = src[barssince(bear_TKx)] + (src[barssince(bear_TKx)]/Leverage)
  56. //SR Ichi 2x
  57. Ichi2xLongLiqLevel = src[barssince(bull_TKx2x)] - (src[barssince(bull_TKx2x)]/Leverage)
  58. Ichi2xShortLiqLevel = src[barssince(bear_TKx2x)] + (src[barssince(bear_TKx2x)]/Leverage)
  59. //SR RSI + BB (OS = oversold, OB = overbought)
  60. RSIBB_OSLiqLevel = src[barssince(RSIos and BBxdown)] - (src[barssince(RSIos and BBxdown)]/Leverage)
  61. RSIBB_OBLiqLevel = src[barssince(RSIob and BBxup)] + (src[barssince(RSIob and BBxup)]/Leverage)
  62. //SR TD
  63. TDLongLiqLevel = src[barssince(TDbuysetup)] - (src[barssince(TDbuysetup)]/Leverage)
  64. TDShortLiqLevel = src[barssince(TDsellsetup)] + (src[barssince(TDsellsetup)]/Leverage)
  65.  
  66. //plots (LLL = Long Liquidation Level; SLL = Short Liquidation Level)
  67.  
  68. plot(TKcross10306030 and src > IchiLongLiqLevel ? IchiLongLiqLevel : false, style = circles, linewidth = 2, color = #70C1B3, title = "Ichi LLL")
  69. plot(TKcross10306030 and src < IchiShortLiqLevel ? IchiShortLiqLevel : false, style = circles, linewidth = 2, color = #F25F5C, title = "Ichi SLL")
  70.  
  71. //Ichi2x
  72. plot(TKcross20603060 and src > Ichi2xLongLiqLevel ? Ichi2xLongLiqLevel : false, offset = 0, style = circles, linewidth = 2, color = #247BA0, title = "Ichi 2x, LLL")
  73. plot(TKcross20603060 and src < Ichi2xShortLiqLevel ? Ichi2xShortLiqLevel : false, style = circles, linewidth = 2, color = #FFE066, title = "Ichi 2x SLL")
  74.  
  75. //rsibb
  76. plot(RSI_BB and src > RSIBB_OSLiqLevel ? RSIBB_OSLiqLevel : false, style = circles, linewidth = 2, color = silver, title = "RSI/BB LLL")
  77. plot(RSI_BB and src < RSIBB_OBLiqLevel ? RSIBB_OBLiqLevel : false, style = circles, linewidth = 2, color = gray, title = "RSI/BB SLL")
  78. //td
  79. plot(DeMark and src > TDLongLiqLevel ? TDLongLiqLevel : false, color = #EFCEFA, linewidth = 2, style = circles, title = "TD LLL")
  80. plot(DeMark and src < TDShortLiqLevel ? TDShortLiqLevel : false, color = #92BCEA, linewidth = 2, style = circles, title = "TD SLL")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement