Hi everyone, Does anyone have the willco indicator for prorealtime?Hi everyone, Does anyone have the willco indicator for prorealtime?
I couldn’t find it in the library.
Searching the web I found out that it requires multiple instruments and some data not available, for its calculations.
Anyway, if anyone has some good news, please let us know.
JSParticipant
Veteran
The Williams Commercial Index is available on TradingView:
https://in.tradingview.com/script/KKBYQPCZ-William-s-Commercial-Index/
It is also discussed in this ProRealTime forum topic:
https://www.prorealcode.com/topic/commoditer-of-trader-cot/#post-90159
study("William's Commercial Index", shorttitle="WILLCO", precision=2)
force_root = input("", title="Override Product")
is_includeoptions = input(false, type=bool, title="Include Options")
fxroot =
ticker == "USDCAD" ? "CD" :
ticker == "USDCHF" ? "SF" :
ticker == "USDCZK" ? "CZ" :
ticker == "USDHUF" ? "FR" :
ticker == "USDILS" ? "IS" :
ticker == "USDJPY" ? "JY" :
ticker == "USDMXN" ? "MP" :
ticker == "USDNOK" ? "UN" :
ticker == "USDPLN" ? "PZ" :
ticker == "USDRUB" ? "RU" :
ticker == "USDSEK" ? "SE" :
ticker == "USDZAR" ? "RA" :
ticker == "EURUSD" ? "EC" :
ticker == "AUDUSD" ? "AD" :
ticker == "GBPUSD" ? "BP" :
ticker == "NZDUSD" ? "NE" :
ticker == "BRLUSD" ? "BR" :
""
root = force_root == "" ? fxroot == "" ? syminfo.root : fxroot : force_root
code = root + (is_includeoptions ? "_FO_L_ALL" : "_F_L_ALL")
is_inversed =
ticker == "USDCAD" ? true :
ticker == "USDCHF" ? true :
ticker == "USDCZK" ? true :
ticker == "USDHUF" ? true :
ticker == "USDILS" ? true :
ticker == "USDJPY" ? true :
ticker == "USDMXN" ? true :
ticker == "USDNOK" ? true :
ticker == "USDPLN" ? true :
ticker == "USDRUB" ? true :
ticker == "USDSEK" ? true :
ticker == "USDZAR" ? true :
false
long_total = security("QUANDL:CFTC/"+code+"|4", "D", close)
short_total = close
oi = security("QUANDL:CFTC/"+code+"|0", "D", close)
long = is_inversed ? short_total : long_total
short = is_inversed ? long_total : short_total
net = long-short
willco = net / oi
length = input(24, title="Period (weeks)")
max = highest(willco, length)
min = lowest(willco, length)
index = 100 * (willco - min) / (max - min)
index_adopted = security("QUANDL:CFTC/"+code+"|5", "D", index)
plot(index_adopted, color = black, title="Index", style=line)
hline(80, color=blue, linestyle=dashed)
hline(20, color=blue, linestyle=dashed)