Add Indi-G, credit to @kerberos007
This commit is contained in:
parent
d14066e3e0
commit
b57fe240e7
56
indi_g.pine
Normal file
56
indi_g.pine
Normal file
@ -0,0 +1,56 @@
|
||||
// Credit to @kerberos007.
|
||||
// Fear & Greed calculation was taken from somewhere, but I can't find the source anymore to give credit.
|
||||
//@version=5
|
||||
indicator(title = "Indi-G", overlay = false)
|
||||
|
||||
// Safe Haven Demand:
|
||||
shd1 = request.security("SPX", "D", (close - close[20]) / close * 100)
|
||||
shd2 = request.security("ZB1!", "D", (close - close[20]) / close * 100)
|
||||
shd = shd1 - shd2
|
||||
|
||||
//Stock Price Breadth:
|
||||
spb1 = request.security("UVOL", "D", close)
|
||||
spb2 = request.security("DVOL", "D", close)
|
||||
spb3 = spb1 - spb2
|
||||
ema19 = ta.ema(spb3, 19)
|
||||
ema39 = ta.ema(spb3, 39)
|
||||
osci = ema19 - ema39
|
||||
spb = ta.cum(osci)
|
||||
|
||||
//Market Momentum:
|
||||
mm1 = request.security("SPX", "D", close)
|
||||
mm2 = request.security("SPX", "D", ta.sma(close, 125))
|
||||
mm = (mm1 - mm2) / mm1 * 100
|
||||
|
||||
//Stock Price Strenth:
|
||||
sps1 = request.security("MAHN", "D", ta.ema(close, 5))
|
||||
sps2 = request.security("MALN", "D", ta.ema(close, 5))
|
||||
sps = ta.ema((sps1 - sps2) / (sps1 + sps2) * 100, 10)
|
||||
|
||||
//Put / Call Ratio:
|
||||
pcr = request.security("USI:PCC", "D", ta.sma(close, 5))
|
||||
|
||||
//Junk Bond Demand
|
||||
jbd1 = request.security("Quandl:ML/USEY|0", "D", close)
|
||||
jbd2 = request.security("Quandl:ML/USTRI|0", "D", close)
|
||||
jbd = jbd2 - jbd1
|
||||
|
||||
//Market Volatility:
|
||||
mv = request.security("VIX", "D", close)
|
||||
|
||||
//Merge:
|
||||
ind_shd = ta.percentrank(shd, 252)
|
||||
ind_spb = ta.percentrank(spb, 252)
|
||||
ind_mm = ta.percentrank(mm, 252)
|
||||
ind_sps = ta.percentrank(sps, 252)
|
||||
ind_pco = 100 - ta.percentrank(pcr, 252)
|
||||
ind_jbd = 100 - ta.percentrank(jbd, 252)
|
||||
ind_mv = 100 - ta.percentrank(mv, 252)
|
||||
|
||||
fear_and_greed = (ind_shd + ind_spb + ind_mm + ind_sps + ind_pco + ind_jbd + ind_mv) / 7
|
||||
plot(fear_and_greed, linewidth = 2, color = color.yellow)
|
||||
|
||||
hline(75, title = "Euphoria", color = color.red, linestyle = hline.style_solid)
|
||||
hline(60, title = "Greed", color = color.maroon, linestyle = hline.style_solid)
|
||||
hline(25, title = "Fear", color = color.green, linestyle = hline.style_solid)
|
||||
hline(10, title = "Capitulation", color = color.lime, linestyle = hline.style_solid)
|
Loading…
Reference in New Issue
Block a user