Commitments of Traders (COT)

Moderator: admin

Commitments of Traders (COT)

Postby Apprentice » Mon Apr 05, 2010 9:48 am

COT.png
COT

I made a simple COT Report chart for US Dollar.

Chart work exclusively on the weekly timeframe.
Last edited by Apprentice on Mon Apr 12, 2010 8:48 am, edited 2 times in total.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Commitments of Traders (COT)

Postby Apprentice » Mon Apr 12, 2010 4:26 am

cot.png
COT


I made some progress, the current version is not fully automated.

I added Major currency pairs, there is room for adding, stock indexes, gold, oil and other instruments for which the report was published.

Now I need to solve the automatic downloading files, unpacking the Zip archive,
add date check.

You can manually download the data, annualof.txt via the following link
http://www.cftc.gov/MarketReports/files/dea/history/deahistfo2010.zip.

Unfortunately, this file has the COT reports only from the beginning of this year.
The absence of historical data, does not affect the analysis.
Last edited by Apprentice on Wed Apr 14, 2010 2:27 am, edited 3 times in total.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Commitments of Traders (COT)

Postby Apprentice » Tue Apr 13, 2010 5:13 am

Updated version, corrected some deficiencies.
Added, automatic selection of currency pairs.
User can now choose the file location using the standard File Open dialog.
COT.lua
COT
(8.92 KiB) Downloaded 1052 times

COT.lua
Beta
(8.96 KiB) Downloaded 976 times
Last edited by Apprentice on Sat Apr 17, 2010 4:45 pm, edited 4 times in total.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Commitments of Traders (COT)

Postby Nikolay.Gekht » Tue Apr 13, 2010 8:11 pm

A couple of recommendation:
1) you can use addFile instead of addString for the parameter with the file name. This will let the user to choose the file using the standard File Open dialog
2) I recommend to load and parse file immediately in Prepare method and then keep just a table with the week as a key. It will eliminate reading the file for each period and will make indicator much faster,
3) You can use assert to show the message to the user.
I.e. just replace
if source:barSize()~="W1" then
...
with
assert (source:barSize()=="W1", "The time frame must be a week!");
and the error will be shown to the user in case he will apply the indicator on non 1-week chart.
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 7 guests