xmd79

Rsi Automatic Fibonacci

Nov 14th, 2021
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 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. // © kberatunlu
  3.  
  4. //@version=4
  5. study("Rsi Automatic Fibonacci", overlay=false, shorttitle="RsiAutoFib")
  6. uzunluk = input(144,minval=5, title ="Fibo Tarama Mesafesi")
  7. //rsi=rsi(close,14)
  8.  
  9.  
  10. len = input(14, minval=1, title="Length")
  11. src = input(close, "Source", type = input.source)
  12. up = rma(max(change(src), 0), len)
  13. down = rma(-min(change(src), 0), len)
  14. rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
  15.  
  16.  
  17. tepe = highest(rsi,uzunluk)
  18. plot(rsi)
  19. dip = lowest(rsi,uzunluk)
  20.  
  21. tepeyeUzaklik = abs(highestbars(rsi,uzunluk))
  22. dibeUzaklik = abs(lowestbars(rsi,uzunluk))
  23.  
  24. kontrol = dibeUzaklik >tepeyeUzaklik ? true : false
  25.  
  26. // Calculation
  27.  
  28. fib618 = kontrol == true ? tepe - ((tepe-dip)*618/1000) : dip + ((tepe-dip)*618/1000)
  29. fib50 = kontrol == true ? tepe - ((tepe-dip)*500/1000) : dip + ((tepe-dip)*500/1000)
  30. fib786 = kontrol == true ? tepe - ((tepe-dip)*786/1000) : dip + ((tepe-dip)*786/1000)
  31. fib886 = kontrol == true ? tepe - ((tepe-dip)*886/1000) : dip + ((tepe-dip)*886/1000)
  32. fib382 = kontrol == true ? tepe - ((tepe-dip)*382/1000) : dip + ((tepe-dip)*382/1000)
  33. fib236 = kontrol == true ? tepe - ((tepe-dip)*236/1000) : dip + ((tepe-dip)*236/1000)
  34.  
  35. // Print
  36.  
  37. plot(tepe, linewidth=1, color=color.green, style=plot.style_line, title="Tepe",trackprice=true,transp=100)
  38. plot(dip, linewidth=1, color=color.red, style=plot.style_line, title="Dip",trackprice=true,transp=100)
  39. plot(fib618, linewidth=1, color=color.black, style=plot.style_line, title="0,618",transp=0)
  40. //plot(fib50, linewidth=1, color=color.black, style=plot.style_line, title="0,5",trackprice=true,transp=100)
  41. //plot(fib786, linewidth=1, color=color.black, style=plot.style_line, title="0,786",trackprice=true,transp=100)
  42. //plot(fib886, linewidth=1, color=color.black, style=plot.style_line, title="0,886",trackprice=true,transp=100)
  43. //plot(fib382, linewidth=1, color=color.black, style=plot.style_line, title="0,382",trackprice=true,transp=100)
  44. //plot(fib236, linewidth=1, color=color.black, style=plot.style_line, title="0,236",trackprice=true,transp=100)
  45.  
  46.  
  47.  
  48. plot(close)
  49.  
Advertisement
Add Comment
Please, Sign In to add comment