Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © kberatunlu
- //@version=4
- study("Rsi Automatic Fibonacci", overlay=false, shorttitle="RsiAutoFib")
- uzunluk = input(144,minval=5, title ="Fibo Tarama Mesafesi")
- //rsi=rsi(close,14)
- len = input(14, minval=1, title="Length")
- src = input(close, "Source", type = input.source)
- up = rma(max(change(src), 0), len)
- down = rma(-min(change(src), 0), len)
- rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
- tepe = highest(rsi,uzunluk)
- plot(rsi)
- dip = lowest(rsi,uzunluk)
- tepeyeUzaklik = abs(highestbars(rsi,uzunluk))
- dibeUzaklik = abs(lowestbars(rsi,uzunluk))
- kontrol = dibeUzaklik >tepeyeUzaklik ? true : false
- // Calculation
- fib618 = kontrol == true ? tepe - ((tepe-dip)*618/1000) : dip + ((tepe-dip)*618/1000)
- fib50 = kontrol == true ? tepe - ((tepe-dip)*500/1000) : dip + ((tepe-dip)*500/1000)
- fib786 = kontrol == true ? tepe - ((tepe-dip)*786/1000) : dip + ((tepe-dip)*786/1000)
- fib886 = kontrol == true ? tepe - ((tepe-dip)*886/1000) : dip + ((tepe-dip)*886/1000)
- fib382 = kontrol == true ? tepe - ((tepe-dip)*382/1000) : dip + ((tepe-dip)*382/1000)
- fib236 = kontrol == true ? tepe - ((tepe-dip)*236/1000) : dip + ((tepe-dip)*236/1000)
- // Print
- plot(tepe, linewidth=1, color=color.green, style=plot.style_line, title="Tepe",trackprice=true,transp=100)
- plot(dip, linewidth=1, color=color.red, style=plot.style_line, title="Dip",trackprice=true,transp=100)
- plot(fib618, linewidth=1, color=color.black, style=plot.style_line, title="0,618",transp=0)
- //plot(fib50, linewidth=1, color=color.black, style=plot.style_line, title="0,5",trackprice=true,transp=100)
- //plot(fib786, linewidth=1, color=color.black, style=plot.style_line, title="0,786",trackprice=true,transp=100)
- //plot(fib886, linewidth=1, color=color.black, style=plot.style_line, title="0,886",trackprice=true,transp=100)
- //plot(fib382, linewidth=1, color=color.black, style=plot.style_line, title="0,382",trackprice=true,transp=100)
- //plot(fib236, linewidth=1, color=color.black, style=plot.style_line, title="0,236",trackprice=true,transp=100)
- plot(close)
Advertisement
Add Comment
Please, Sign In to add comment