Guest User

McGinley Dynamic Convergence / Divergence [LazyBear]

a guest
Sep 12th, 2014
10,300
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. //
  2. // @author LazyBear
  3. // List of all my indicators:
  4. // https://docs.google.com/document/d/15AGCufJZ8CIUvwFJ9W-IKns88gkWOKBCvByMEvm5MLo/edit?usp=sharing
  5. //
  6. study(title="McGinley Dynamic Convergence/Divergence", shorttitle="MDCD_LB")
  7. source = close
  8. calc_mg(source, length) =>
  9. mg = na(mg[1]) ? ema(source, length) : mg[1] + (source - mg[1]) / (length * pow(source/mg[1], 4))
  10. mg
  11.  
  12. fastLength = input(12, minval=1), slowLength=input(26,minval=1)
  13. signalLength=input(9,minval=1)
  14. fastMA = calc_mg(source, fastLength)
  15. slowMA = calc_mg(source, slowLength)
  16. macd = fastMA - slowMA
  17. signal = sma(macd, signalLength)
  18. hist = macd - signal
  19. plot(hist, color=red, style=histogram)
  20. plot(macd, color=blue)
  21. plot(signal, color=orange)
Advertisement
Comments
Add Comment
Please, Sign In to add comment