xmd79

CMO

Oct 9th, 2021
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. //@version=4
  2. study(title="CMO", shorttitle="ChandeMO", format=format.price, precision=2, resolution="")
  3. length = input(10, minval=1)
  4. src = input(close, "Source", type = input.source)
  5. momm = change(src)
  6. f1(m) => m >= 0.0 ? m : 0.0
  7. f2(m) => m >= 0.0 ? 0.0 : -m
  8. m1 = f1(momm)
  9. m2 = f2(momm)
  10. sm1 = sum(m1, length)
  11. sm2 = sum(m2, length)
  12. percent(nom, div) => 100 * nom / div
  13. chandeMO = percent(sm1-sm2, sm1+sm2)
  14. plot(chandeMO, "Chande MO", color=#2962FF)
  15.  
  16. hline(25, color=#787B86, linestyle=hline.style_dashed, title="Over Bought")
  17. hline(-25,color=#787B86, linestyle=hline.style_dashed, title="Over sold")
  18. hline(0, color=#787B86, linestyle=hline.style_dashed, title="zero line")
Advertisement
Add Comment
Please, Sign In to add comment