Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study(title="guppyMACD", overlay=false)
- dofish = input(true, title="Plot fisher transform?")
- length = input(title="MFI Length", type=integer, defval=14, minval=1, maxval=2000)
- domfi = input(true, title="Use MFI as well as RSI?")
- src = hlc3
- //mfi
- upper = sum(volume * (change(src) <= 0 ? 0 : src), length)
- lower = sum(volume * (change(src) >= 0 ? 0 : src), length)
- mf = rsi(upper, lower)
- //rsi
- len = input(14, minval=1, title="RSI Length")
- up = rma(max(change(src), 0), len)
- down = rma(-min(change(src), 0), len)
- rsi2 = (down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)))
- rsi = domfi ? (mf + rsi2)/2 : rsi2
- //guppy emas
- short1 = ema(rsi, 3)
- short2 = ema(rsi, 5)
- short3 = ema(rsi, 7)
- short4 = ema(rsi, 10)
- short5 = ema(rsi, 12)
- short6 = ema(rsi, 15)
- long1 = ema(rsi, 30)
- long2 = ema(rsi, 35)
- long3 = ema(rsi, 40)
- long4 = ema(rsi, 45)
- long5 = ema(rsi, 50)
- long6 = ema(rsi, 60)
- //fisher transform code
- len3 = input(9, minval=1, title="Fisher Length")
- high_ = highest(hl2, len3)
- low_ = lowest(hl2, len3)
- round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val
- value = round_(.66 * ((hl2 - low_) / max(high_ - low_, .001) - .5) + .67 * nz(value[1]))
- fish1 = .5 * log((1 + value) / max(1 - value, .001)) + .5 * nz(fish1[1])
- fish2 = fish1[1]
- hline(30)
- hline(22.5)
- hline(15)
- hline(7.5)
- hline(0)
- hline(-7.5)
- hline(-15)
- hline(-22.5)
- hline(-30)
- plot((short1-long6), color = #E62C2C, style=area)
- plot((short2-long5), color = #3B3B3B, style=area)
- plot((short3-long4), color = #5C5C5C, style=area)
- plot((short4-long3), color = #757575, style=area)
- plot((short5-long2), color = #919191, style=area)
- plot((short6-long1), color = #B5B5B5, style=area)
- plot(dofish ? fish1*10:na, color=black, style=line, title="Fisher")
- //plot(fish2*10, color=orange, title="Trigger", transp=90)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement