Advertisement
Guest User

Untitled

a guest
May 11th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. study(title="guppyMACD", overlay=false)
  2.  
  3. dofish = input(true, title="Plot fisher transform?")
  4. length = input(title="MFI Length", type=integer, defval=14, minval=1, maxval=2000)
  5. domfi = input(true, title="Use MFI as well as RSI?")
  6.  
  7.  
  8. src = hlc3
  9. //mfi
  10. upper = sum(volume * (change(src) <= 0 ? 0 : src), length)
  11. lower = sum(volume * (change(src) >= 0 ? 0 : src), length)
  12. mf = rsi(upper, lower)
  13.  
  14. //rsi
  15. len = input(14, minval=1, title="RSI Length")
  16. up = rma(max(change(src), 0), len)
  17. down = rma(-min(change(src), 0), len)
  18. rsi2 = (down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)))
  19.  
  20. rsi = domfi ? (mf + rsi2)/2 : rsi2
  21.  
  22. //guppy emas
  23. short1 = ema(rsi, 3)
  24. short2 = ema(rsi, 5)
  25. short3 = ema(rsi, 7)
  26. short4 = ema(rsi, 10)
  27. short5 = ema(rsi, 12)
  28. short6 = ema(rsi, 15)
  29.  
  30. long1 = ema(rsi, 30)
  31. long2 = ema(rsi, 35)
  32. long3 = ema(rsi, 40)
  33. long4 = ema(rsi, 45)
  34. long5 = ema(rsi, 50)
  35. long6 = ema(rsi, 60)
  36.  
  37. //fisher transform code
  38. len3 = input(9, minval=1, title="Fisher Length")
  39. high_ = highest(hl2, len3)
  40. low_ = lowest(hl2, len3)
  41. round_(val) => val > .99 ? .999 : val < -.99 ? -.999 : val
  42. value = round_(.66 * ((hl2 - low_) / max(high_ - low_, .001) - .5) + .67 * nz(value[1]))
  43. fish1 = .5 * log((1 + value) / max(1 - value, .001)) + .5 * nz(fish1[1])
  44. fish2 = fish1[1]
  45. hline(30)
  46. hline(22.5)
  47. hline(15)
  48. hline(7.5)
  49. hline(0)
  50. hline(-7.5)
  51. hline(-15)
  52. hline(-22.5)
  53. hline(-30)
  54.  
  55. plot((short1-long6), color = #E62C2C, style=area)
  56. plot((short2-long5), color = #3B3B3B, style=area)
  57. plot((short3-long4), color = #5C5C5C, style=area)
  58. plot((short4-long3), color = #757575, style=area)
  59. plot((short5-long2), color = #919191, style=area)
  60. plot((short6-long1), color = #B5B5B5, style=area)
  61. plot(dofish ? fish1*10:na, color=black, style=line, title="Fisher")
  62. //plot(fish2*10, color=orange, title="Trigger", transp=90)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement