gurple

DOW / GOLD Ratio

Here's a new version with color goodness and using CL1! as the gold spot source (longer history).

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//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)