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")
English
English (UK)
English (IN)
Deutsch
Français
Español
Italiano
Polski
Türkçe
Русский
Português
Bahasa Indonesia
Bahasa Melayu
ภาษาไทย
Tiếng Việt
日本語
한국어
简体
台灣
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 My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out