altcoin index oscillator

Compare alt coins to the "altcoin index", an average of a selection of alt coins.
Above zero means the coin you are viewing is worth more than the index, indicating the possibility of overbought.
Below zero indicating the opposite, a possibility of oversold.
Press the cog icon to select which alt coins you want included in the index.

The coins in the index are ALTBTC, meaning their value against BTC . Due to this the indicator is useless when viewing BTC only charts.
Skrip open-source

Sejalan dengan semangat TradingView, penulis skrip ini telah mempublikasikannya secara open-source, sehingga para trader dapat memahami dan memverifikasinya. Salut untuk sang penulis! Anda dapat menggunakannya secara gratis, tetapi penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk dapat menggunakannya didalam sebuah chart.

Inggin menggunakan skrip ini pada chart?
//study("altcoin averages")
study("altcoin index oscillator", overlay=false)

curr = security(tickerid, period, ohlc4)

ch1 = input(true, "include ppcbtc", bool)
ch2 = input(false, "include ethbtc", bool)
ch3 = input(true, "include nmcbtc", bool)
ch4 = input(true, "include nxtbtc", bool)
ch5 = input(true, "include xmrbtc", bool)

count = ch1 + ch2 + ch3 + ch4 + ch5

ppc = iff(ch1, security("THEROCKTRADING:PPCBTC", period, ohlc4), 0)
eth = iff(ch2, security("KRAKEN:ETHXBT", period, ohlc4), 0)
nmc = iff(ch3, security("THEROCKTRADING:NMCBTC", period, ohlc4), 0)
nxt = iff(ch4, security("HITBTC:NXTBTC", period, ohlc4), 0)
xmr = iff(ch5, security("HITBTC:XMRBTC", period, ohlc4), 0)

average = avg(ppc, eth, nmc, nxt, xmr)
diff = (curr - average) / (average)
max = highest(diff, 21)
min = lowest(diff, 21)
highestAbs = abs(max) > abs(min) ? abs(max) : abs(min)
osc = diff / highestAbs

over = diff > 0
under = diff < 0

colordef = over ? red : under ? green : white

plot(osc, "osc", color=colordef, style=line)

plot(1, title = "Top Line", color = white, linewidth = 1)
plot(0, title = "Zero Line", color = yellow, linewidth = 1)
plot(-1, title = "Bottom Line", color = white, linewidth = 1)