DOW / GOLD Ratio

162 0 3
Here's a new version with color goodness and using CL1!             as the gold             spot source (longer history).
Remove from Favorite Scripts Add to Favorite Scripts
//study(title="DOW/GOLD", shorttitle="DOW/GLD", overlay=false)
//sym(s) => security(s, period, close)
//DOWVGLD = (sym("DOWI") / sym("XAUUSD"))
//len = input(260, minval=1, title="Length")
//out = ema(DOWVGLD, len)
//plot(out, title="EMA", color=green)
//plot(40, color=red)
//plot(30, color=#EBC87A)
//plot(5, color=blue)
//plot(3.20, color=red)
//plot(DOWVGLD, color=navy, linewidth=1)

// Below is version 2
study(title="DOW/GOLD", shorttitle="DOW/GLD", overlay=false)
sym(s) => security(s, period, close)
DOWVGLD = (sym("DOWI") / sym("GC1!"))
len = input(260, minval=1, title="EMA Length")
out = ema(DOWVGLD, len)

WARNING_HIGH = DOWVGLD > input(40, title="Equities Too Hot")
SWTCH_2_GLD = DOWVGLD > input(30, title="Switch to Gold")
TRANSITION = DOWVGLD > input(6, title="Transition State") // Market middle ground
SWTCH_2_EQTS = DOWVGLD < input(6, title="Switch to Equities")
WARNING_LOW = DOWVGLD < input(3.20, title="Gold Too Hot")

custcolor = WARNING_HIGH ? red : SWTCH_2_GLD ? #EBC87A : TRANSITION ? teal : SWTCH_2_EQTS ? purple : WARNING_LOW ? red : navy

plot(out, title="EMA", color=green)
//plot(40, color=red)
//plot(30, color=#EBC87A)
//plot(5, color=blue)
//plot(3.20, color=red)
plot(DOWVGLD, color=custcolor, linewidth=1)
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文