gurple

DOW / GOLD Ratio (gurple)

Does what it says on the tin.

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 vs. GOLD Ratio", shorttitle="DOW/GOLD", overlay=false)
sym(s) => security(s, period, close)
DOWvGOLD = (sym("DOWI") / sym("GC1!"))
len = input(260, minval=1, title="EMA Length")
out = ema(DOWvGOLD, len)

//
lltssrc = DOWvGOLD
lltslen=input(90, minval=1, title="Length")
lltsout = ema(lltssrc, lltslen)
data = lltssrc/lltsout

buy = data > 1
sell = data < 1

lltscolor = buy ? olive : sell ? orange : blue
//

WARNING_HIGH = DOWvGOLD > input(40, title="Equities Too Hot")
SWTCH_2_GLD = DOWvGOLD > input(30, title="Switch to Gold")
TRANSITION = DOWvGOLD > input(6, title="Transition State") // Market middle ground
SWTCH_2_EQTS = DOWvGOLD < input(6, title="Switch to Equities")
WARNING_LOW = DOWvGOLD < 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=lltscolor)
plot(DOWvGOLD, color=custcolor, linewidth=1, trackprice=true)