tlove777

MACD Gold

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")
United States
United Kingdom
India
Deutschland
España
France
Việt Nam
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Support Priority Support Report Issue Ideas Published Followers Following Private Messages Chat Sign Out