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