Greeny

COT (Legacy): Commercial Interest

Open Interest for commercial traders from legacy commitment of traders ( COT ) report. For the main symbol but also allows to override it. Also allows to include options in consideration.
Eliminar de Scripts favoritos. Añadir a Scripts favoritos.
study("Commercial Interest", shorttitle="Com Int", precision=0)
force_root = input("", title="Override Product")
is_includeoptions = input(false, type=bool, title="Include Options")

fxroot =
	  ticker == "USDCAD" ? "CD" : 
	  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 == "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 = security("QUANDL:CFTC/"+code+"|5", "D", close)

long = is_inversed ? short_total : long_total
short = is_inversed ? long_total : short_total

plot(long, color = green, title="Long")
plot(short, color = red, title="Short")
plot(long-short, color = yellow, title="Net", style=histogram)
hline(0, color=yellow, linestyle=dashed)
Is there a way to add the EURGBP pair to this? I tried editing the code by adding to the fxroot variable but it doesn't display (other pairs work). The CFTC code is #299741
Responder
Hi Greeny! Same comment as on the Open interest, how do I create the Commercial interest for gold ? W hat is important here is to show the net commercial position as a line. Is it possbile?
+2 Responder
Greeny LEONES
1. Apply this script to the chart
2. Switch the GC1!
3. Go to the indicator settings and change Net style from histogram to line.
+2 Responder
LEONES Greeny
what do you mean apply the scipt to the chart? copy the script and paste it in the pine scipt editor?
Responder
LEONES LEONES
Greeny, can I ask you to TEST something please:

CONTRACT CLU2014 (SEPTEMBER CRUDE_OIL FUTURE)

WHAT IS THE NET COMMERCIAL POSITION (long-short) YOU GET ON THE CHART?

Thank you
Responder
LEONES LEONES
Greeny

seems ok on the 1st check:

CRUDE OIL

NET COMMERCIAL = -404265 contracts

The only thing is that this data refers to the 22nd of July. The new CFTC report of the 29th of July has already been issued. So we have two weeks old data. I'm chacking with Qundnl where are they normally uploading the data. We need to have the results as sson as possible, there could be big chnages in two weeks...


Crude
+2 Responder
Greeny LEONES
I have the same number.
Agree, quandl needs to adjust their update policy for this datasets. I'll try to contact them also.
+1 Responder
LEONES Greeny
great, the results are issued by CFTC on friday. In reality they refer to the data collected on the previous tuesday, but nothing we can do here this is how CFTC works. If we can have the data the same day (friday) or saturday it's ok. I have tried to use the code for the GRAINS (wheat, soybeans, corn etc) but it doesn't work. Is it the same for you? Try for example ZSU2104 (September Soybean)
+1 Responder
LEONES Greeny
HI Greeny,

how can I get the chart from CME contracts such as grains (soybean, wheat, corn etc) or live stock (such as live cattle, hogs etc). If I use this code the vhart doen't appear. I have talked to the quandl (thay could have choosen and easier name..:) and they said all the data is there ready
+3 Responder
LEONES LEONES
sorry for the typos .. I'm on the train..
Responder
Inicio Analizador de acciones Analizador de Forex Crypto Screener Calendario económico Cómo funciona Funcionalidades del gráfico Precios Normas Moderadores Soluciones broker y sitio web Widgets Soluciones gráficas Centro de ayuda Solicitud de funcionalidad Blog y Noticias Preguntas frecuentes Wiki Twitter
Perfil Opciones de configuración del perfil Cuenta y facturación Monedas TradingView Mis Tickets de Soporte Centro de ayuda Ideas publicadas Seguidores Siguiendo Mensajes privados Chat Cerrar sesión