Greeny

William's Commercial Index

777 6 108
William's Commercial Index
Remove from Favorite Scripts Add to Favorite Scripts
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)
You are the man!!!
+1 Reply
Greeny, great! how are the upper and lower bands calculated?
Reply
I am not getting anything on the indicator , What could be wrong?
Applying to EURUSD Charts.
Reply
Hello, Greeny! Can u help me with add you script on my chart?
snapshot

Thanks
Reply
Nice work Greeny!!!!

I dont find the right abbreviations for the following markets for the COT data:
-Euro
-Mexican Peso
-Corn
-Rough Rice
-Lean Hogs
Reply
I forgot to ask... Is it possible to program a panel which has the COT markets and an overview of the values of the COT indicators?
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Forex Signal Finder 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 Account and Billing Sign Out