Advertisement
Guest User

Tweaked MA Cross by ninja

a guest
May 30th, 2014
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. //Created by user ninjabenja and LazyBear updated 5-30-2014
  2. //MA Cross Indicator "for dummies". Changes Colors Based on the short and long crossing and plots a cross at the intersection
  3. //This code was bastardized from ChrisMoody's CM_MacD_Ult_MTF... which was a revision of MAcd Cross from "TheLark".
  4.  
  5. study(title="Tweaked_MA_Cross", shorttitle="Tweaked_MA_Cross", overlay=true)
  6. source = close
  7.  
  8. fastLength = input(12, minval=1), slowLength=input(26,minval=1)
  9.  
  10. short = sma(source, fastLength)
  11. long = sma(source, slowLength)
  12.  
  13. useCurrentRes = input(true, title="Use Current Chart Resolution?")
  14. resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=resolution, defval="60")
  15.  
  16. line_colorChange = input(true,title="Change Line Color when Fast crosses Slow?")
  17.  
  18. res = useCurrentRes ? period : resCustom
  19.  
  20. //LINE Color Definitions
  21. line_IsAbove = short >= long
  22. line_IsBelow = short < long
  23.  
  24. shortColor= line_IsAbove ? green : red
  25. longColor= line_IsBelow ? green : red
  26.  
  27. sl=plot(short, color = shortColor, linewidth=2)
  28. ll=plot(long, color = longColor, style=3, linewidth=2)
  29. fill(sl,ll)
  30. plot(cross(short, long) ? short : na, style = cross, linewidth = 4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement