Ni6HTH4wK

[LAVA] Early Warning Indicator

Combined the RSI inverse of gold             to USD with the Dollar index             (or whatever stock symbol that may be inverted/complementary) with another asset/currency, like bitcoin , you can basically be well informed when a potential move is on the horizon. Settings allow for inverse settings and de-combining the two pairs as well as a nice cloud look if all the lines get annoying.
Remove from Favorite Scripts Add to Favorite Scripts
study(title="[LAVA] Early Warning Indicator", shorttitle="EWI_L")
len = input(14, minval=1, title="Length")
sym = input("XAUUSD", title="Symbol")
inv = input(true, type=bool, title="Inverse?")
sym2 = input("DXY", title="Symbol")
inv2 = input(false, type=bool, title="Inverse?")
comb = input(true, type=bool, title="Combine?")

res = period, src = hl2, src2 = security(sym, res, src), src3 = security(sym2, res, src)
neg = inv ? -1 : 1, neg2 = inv2 ? -1 : 1, rsi_neg = inv ? 1 : -1, rsi_neg2 = inv2 ? 1 : -1

up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 50 - (100 / (1 + up / down))
pri = ema(rsi,len)

sec_up = rma(max(change(src2), 0), len)
sec_down = rma(-min(change(src2), 0), len)
sec_rsi_raw = sec_down == 0 ? 100 : sec_up == 0 ? 0 : 50 - (100 / (1 + sec_up / sec_down))
sec_rsi = sec_rsi_raw*rsi_neg
sec = ema(sec_rsi_raw, len)*neg

ter_up = rma(max(change(src3), 0), len)
ter_down = rma(-min(change(src3), 0), len)
ter_rsi_raw = ter_down == 0 ? 100 : ter_up == 0 ? 0 : 50 - (100 / (1 + ter_up / ter_down))
ter_rsi = ter_rsi_raw*rsi_neg2
ter = ema(ter_rsi_raw, len)*neg2

com = avg(sec,ter)
com_rsi = avg(rsi,sec_rsi,ter_rsi)

p1 = plot(pri, color=teal, linewidth=2)
p2 = plot(sec, color=comb?na:yellow, linewidth=2)
p3 = plot(ter, color=comb?na:green, linewidth=2)
p4 = plot(com, color=comb?red:na, linewidth=2)
p5 = plot(com_rsi, color=gray)
h1 = hline(20)
h2 = hline(-20)

fill(p1, p4, color=white, transp=85)
fill(p2, p4, color=white, transp=85)
fill(p3, p4, color=white, transp=85)

buy = cross(pri,com) and pri>com ? 25 : na
plot(buy, color=green, style=histogram, linewidth=3)

prolly_buy = cross(com_rsi,min(pri,com)) and com_rsi>min(pri,com) ? -10 : na
plot(prolly_buy, color=green, style=histogram, linewidth=2)

sell = cross(pri,com) and pri<com ? -25 : na
plot(sell, color=red, style=histogram, linewidth=3)

prolly_sell = cross(com_rsi,max(pri,com)) and com_rsi<max(pri,com) ? 10 : na
plot(prolly_sell, color=red, style=histogram, linewidth=2)
LazyBear PRO
2 years ago
Nice work.
Reply
stock1111
2 years ago
Can somebody explain how we can use this indicator in Fx trading? thank you.
Reply
Ni6HTH4wK PRO stock1111
2 years ago
You could probably use it directly without change since fx is similar.
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out