tlove777

MACD Gold

137 0 7
Upward trends in Gold             ( GLD             ) seem to be a precursor to downward trends in the SP             500.
Remove from Favorite Scripts Add to Favorite Scripts
//Charts EMA of Gold which seems to inversely follow SP 500
//Created by Trevor Love 2016
////////////////////////////////////////////////////////////
study(title="MACD Gold", shorttitle="MACD Gold")
fastLength = input(8, minval=1)
slowLength = input(26,minval=1)
signalLength=input(11,minval=1)
hline(0, color=purple, linestyle=dashed)
fastMA = security("GLD", "D", ema(close, fastLength))
slowMA = security("GLD", "D", ema(close, slowLength))
macd = fastMA - slowMA
signal = sma(macd, signalLength)
series = security("GLD", "D", ema(close, 60))
sersig = series/105
macsig = (macd-signal)*4
maccolor = macsig > 0? falling(macsig, 1)? lime : blue : red
pos = iff(signal < macd , 1,
	    iff(signal > macd, -1, nz(pos[1], 0))) 
barcolor(pos == -1 ? red: pos == 1 ? green : blue)
plot(macsig, color=maccolor, style=histogram, linewidth=3)
//plot(sersig, color=black, title="GLDSMA")
plot(signal, color=red, title="SIGNAL")
plot(macd, color=blue, title="MACD")
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out