xmd79

KST MTF

Oct 8th, 2021
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 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. // © JokoAji
  3.  
  4. //@version=4
  5. study("KST", overlay = false)
  6.  
  7. a1 = 10//input(10, title="Period Rate-of-Change 1")
  8. b1 = 15//input(15, title="Period Rate-of-Change 2")
  9. c1 = 20//input(20, title="Period Rate-of-Change 3")
  10. d1 = 30//input(30, title="Period Rate-of-Change 4")
  11. e1 = 10//input(10, title="Period SMA 1")
  12. f1 = 10//input(10, title="Period SMA 2")
  13. g1 = 10//input(10, title="Period SMA 3")
  14. h1 = 15//input(15, title="Period SMA 4")
  15. i1 = 9//input(9, title="KST Signal SMA Period")
  16. difftime = input(true, title="Show Time Frame 1 ?")
  17. res1 = input(title="Different Timeframe :", type=input.resolution, defval="")
  18. diftime = input(true, title="Show Time Frame 2 ?")
  19. res2 = input(title="Different Timeframe :", type=input.resolution, defval="5")
  20. a2 = 10//input(10, title="MTF Period Rate-of-Change 1")
  21. b2 = 15//input(15, title="MTF Period Rate-of-Change 2")
  22. c2 = 20//input(20, title="MTF Period Rate-of-Change 3")
  23. d2 = 30//input(30, title="MTF Period Rate-of-Change 4")
  24. e2 = 10//input(10, title="MTF Period SMA 1")
  25. f2 = 10//input(10, title="MTF Period SMA 2")
  26. g2 = 10//input(10, title="MTF Period SMA 3")
  27. h2 = 15//input(15, title="MTF Period SMA 4")
  28. i2 = 9//input(9, title="MTF KST Signal SMA Period")
  29. //backcol = input(true, title="Show Background Color Current Timeframe ?")
  30. //backcol2 = input(true, title="Show Background Color Different Timeframe ?")
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37. roc1 = sma(roc(close, a1), e1)
  38. roc2 = sma(roc(close, b1), f1)
  39. roc3 = sma(roc(close, c1), g1)
  40. roc4 = sma(roc(close, d1), h1)
  41. KST = roc1 + (roc2*2) + (roc3*3) + (roc4*4)
  42. KSTSignal = sma(KST, i1)
  43. KST_MTF_1 = difftime ? security(syminfo.tickerid, res1, KST) : na
  44. KSTSignal_MTF_1 = difftime ? security(syminfo.tickerid, res1, KSTSignal) : na
  45.  
  46.  
  47.  
  48.  
  49. roc5 = sma(roc(close, a2), e2)
  50. roc6 = sma(roc(close, b2), f2)
  51. roc7 = sma(roc(close, c2), g2)
  52. roc8 = sma(roc(close, d2), h2)
  53. KST2 = roc5 + (roc6*2) + (roc7*3) + (roc8*4)
  54. KSTSignal2 = sma(KST2, i2)
  55. KST_MTF = diftime ? security(syminfo.tickerid, res2, KST2) : na
  56. KSTSignal_MTF = diftime ? security(syminfo.tickerid, res2, KSTSignal2) : na
  57.  
  58. plot(KST_MTF_1, style = plot.style_line, linewidth = 1, color=color.lime, title="KST")
  59. plot(KSTSignal_MTF_1, style = plot.style_line, linewidth = 1, color=color.red, title="KST Signal")
  60. plot(KST_MTF, style = plot.style_line, linewidth = 1, color=color.lime, title="KST Different TimeFrame")
  61. plot(KSTSignal_MTF, style = plot.style_line, linewidth = 1, color=color.red, title="KST Signal Different TimeFrame")
  62. hline(0)
  63.  
  64. //test1 = (KST >= KSTSignal) ? lime : na
  65. test2 = (KST_MTF >= KSTSignal_MTF) ? color.lime : color.red
  66. //bgcolor(test1, transp=90)
  67. bgcolor(test2, transp=90)
  68.  
  69.  
Advertisement
Add Comment
Please, Sign In to add comment