xmd79

TCS • STOCH"

May 27th, 2023
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © zendrer
  3.  
  4. //@version=5
  5. indicator("TCS • STOCH", overlay = false)
  6.  
  7. //••••••••••••••
  8. //INPUT
  9. //••••••••••••••
  10. //----------------------------------------------------------------
  11. length = input.int(15, 'Length', minval=1)
  12. src = input(close, 'Source')
  13. //----------------------------------------------------------------
  14.  
  15. //••••••••••••••
  16. //FUNCTION
  17. //••••••••••••••
  18. //STOCH RSI
  19. //----------------------------------------------------------------
  20. rsi = ta.rsi(src,length )
  21. rsima = ta.ema(rsi, length)
  22. smoothK = input.int(3, "K", minval=1)
  23. smoothD = input.int(3, "D", minval=1)
  24. k = ta.sma(ta.stoch(rsi, rsi, rsi, length), smoothK)
  25. d = ta.sma(k, smoothD)
  26. //----------------------------------------------------------------
  27.  
  28. //TRIGGER
  29. //----------------------------------------------------------------
  30. triggerx = (ta.ema(ta.rsi(ta.ema(src, length/2), length), length/2))
  31. trigger = (ta.vwma(ta.stoch(triggerx, triggerx, triggerx, length), length))
  32. trigger1 = (ta.vwma(ta.stoch(triggerx, triggerx, triggerx, length), length)) + 80
  33. trigger2 = (ta.vwma(ta.stoch(triggerx, triggerx, triggerx, length), length)) - 80
  34. trigma = ta.stoch(trigger,trigger,trigger,length)
  35. //----------------------------------------------------------------
  36.  
  37. //••••••••••••••
  38. //PLOT
  39. //••••••••••••••
  40. //----------------------------------------------------------------
  41. A = plot(trigma, color= color.new(color.gray,80))
  42. B = plot(trigger , color=color.new(color.white,80))
  43. C = plot(trigger1 , "oversold", color=(trigger1) > 100 ? na : color.new(color.purple,100), editable=false)
  44. D = plot(trigger2 , "overbought", color=(trigger2) < 0 ? na : color.new(color.lime,100), editable=false)
  45. E = plot(0, color = color.new(color.white,100), editable=false)
  46. F = plot(100, color = color.new(color.white,100), editable=false)
  47. fill(E, D, color = (trigger2) < 0 ? na : (trigger2 > trigger2[1] ? color.new(color.lime,10) : color.new(color.lime,60)))
  48. fill(F, C, color = (trigger1) > 100 ? na : (trigger1 < trigger1[1] ? color.new(color.purple,10) : color.new(color.purple,60)))
  49. fill(A,B, color = trigger > trigma ? color.new(color.gray,30) :color.new(color.white,30))
  50.  
  51. hline(100)
  52. hline(0)
  53.  
  54. plot(ta.crossunder(k,d) and k > 60 and trigma > 99 and trigger > 90 ? trigger : na, color = color.purple , style = plot.style_cross, linewidth = 3, editable=false)
  55. plot(ta.crossover(k,d) and k < 40 and trigma < 1 and trigger < 35 ? trigger : na, color = color.lime , style = plot.style_circles, linewidth = 3, editable=false)
  56. plot(ta.crossunder(k,d) and k > 60 and trigma > 99 and trigger > 65 ? trigger : na, color = color.purple , style = plot.style_circles, linewidth = 3, editable=false)
  57. //plot(trigger < 50 and ta.crossunder(trigger,trigma) or ta.crossover(trigger,0) and rsi > 55 and rsi > rsima and trigger < trigma and trigger1 > trigger1[1] and trigger1 < 100 ? trigger : na, color = color.lime , style = plot.style_circles, linewidth = 3, editable=false)
  58. //plot(trigger > 50 and ta.crossover(trigger,trigma) or ta.crossunder(trigger,100) and rsi < 55 and rsi < rsima and trigger > trigma and trigger2 < trigger2[1] and trigger2 > 0 ? trigger : na, color = color.purple , style = plot.style_circles, linewidth = 3, editable=false)
  59. //plot(ta.crossover(trigma,trigger1) and rsi > 47 and rsi > rsima ? trigger : na, color = color.lime , style = plot.style_cross, linewidth = 3, editable=false)
  60. //plot(ta.crossunder(trigma,trigger2) and rsi < 47 and rsi < rsima ? trigger : na, color = color.purple , style = plot.style_cross, linewidth = 3, editable=false)
  61. //----------------------------------------------------------------
  62. //END
Advertisement
Add Comment
Please, Sign In to add comment