Final Project
Note: All files and information related to the final project are located in the Final Project folder on Courseworks
Based on the EasyLanguage pseudo-code describing the basic trend-following system “Channel WithDDControl”, you need to program this system and apply it to two of the futures markets from the following set:
Number | Blp Ticker | TD Ticker | Description | Data From |
1 | BO | BO | Soybean oil | Jul-82 |
2 | DX | DX | US dollar index | Jul-89 |
3 | HG | HG | Copper | Dec-89 |
4 | HO | HO | Heating oil | Jan-84 |
5 | JO | JO | FCOJ – Frozen concentrated orange juice | Jul-87 |
6 | JY | JY | Japanese Yen | Mar-77 |
7 | S | SY | Soybeans | Jul-82 |
8 | SB | SB | Sugar #11 | Jul-86 |
9 | SF | SF | Swiss Franc | Dec-74 |
10 | TU | TU | US Treasury note – 2-year | Jan-91 |
11 | TY | TY | US Treasury note – 10-year | Jan-83 |
12 | W | WC | Wheat | Jul-82 |
13 | SM | SM | Soybean meal | Jul-82 |
14 | CO | CO | Brent crude oil | Aug-03 |
15 | FC | FC | Feeder cattle | Jan-78 |
16 | DU | BZ | German Schatz – 2-year | Mar-97 |
17 | PL | PL | Platinum | Oct-07 |
18 | XB | XB | Gasoline (RBOB) | Oct-06 |
19 | XBT | XBT | Bitcoin Coinbase | Jan-15 |
One of the markets-primary is for you to choose, another-secondary market must be XBT (Bitcoin). Each student group will first need to pick one primary futures market from this set. It is mandatory that all student groups have different primary markets. The .asc data files containing the OHLC (opening high low close) bars with 5-minute resolution from inception until now are also in the Final Project folder, as denoted by their ticker symbols. Please, note that Bloomberg is using the Bloomberg ticker convention, whereas the data files use the provider’s ticker convention of TickData (TD). Also for your reference and various contract parameter settings information uploaded are their Bloomberg descriptions (DES screens) and the latest daily OHLC bars chart (GPO screens). All of these markets should present you with trend-following properties to various degrees of strength. There is none and I have no preference as to which market you pick – it is up to your personal preferences and taste. After you polish your code results on the primary market, each group needs to apply everything developed to the secondary market XBT (Bitcoin), and repeat all the tested code on it. Secondary market is the same for different student groups. Please, note that you will not be judged on how much money your strategy makes or on how big is the value of your risk-adjusted return. Instead, you will be judged on how close your results are to the expected ones.
Also for your convenience, I have uploaded the “Medeleyev Table” of the futures markets that I was discussing during class (the file “TF Data.xls” as Excel or “FuturesContractsParameters.pdf” as pdf, although you may use the Bloomberg DES screens that I referred to earlier), which, among other things, contain: TickData Ticker (column B); Bloomberg Ticker (column C), Description (column D), local currency approximate contract value (column G), local currency Point Value (column H), etc. Some or all of these parameters you may need in your experimentation. The important parameter that you will absolutely need to use is slippage, denoted as “Slpg” in column V. This is the suggested full transaction cost to be used by you if you buy and then sell (or sell and then buy) one futures contract of your chosen market. Every time you do one round-turn transaction like that you will need to subtract that value from the current $P&L (USD Profit and Loss or equity).
Each group will select one market, and should email me and TA their choice as soon as possible. In the event should two groups choose the same market, the group who sent us the email first will “secure” that market to themselves. All parameters such as tick size, trading hours, and point value should be taken from the Description screens or TF Data file and double-checked with us, if in doubt. Please pay attention to the fact that the timestamps in the data files are expressed in the local (exchange) time, i.e., the CME in Chicago is one hour behind us here in New York City.
Also, pay attention to the fact that there may be a factor of 100 (or 1/100) difference in the price in the file and the price on Bloomberg: the TF Data futures contracts parameters file will help you with this – see the magenta colored lines.
You will need to first use the in-sample length of 4 years (re-calculate it into the approximate number of 5-min bars to use in each case). I would like you to use the net profit to max drawdown ratio as the target function for parameter optimization. I would like to propose that you use the following ranges of parameters (you can adjust those if you have a more or less powerful computer, for example):
ChnLen = 500, 10000, 10 (start at, end at, step with, in 5-mins intervals, 951 in total); and
StpPct = 0.005, 0.10, 0.001 (96 in total).
This corresponds to grid points in each two-parameter optimization. This optimization can be solved by a direct and full look-through in search for a single maximum (if you can propose and implement alternative search procedures in addition to full search – it will be rewarded while grading). As the number of parameters is small (only two) and the sample space is relatively small (on the order of ), this should be doable on virtually any modern computer. In this experiment, you always have to choose the formally best parameters point. Repeat the optimization procedure by moving your in-sample period from the very end (or start) of your full data sample every quarter (3-months) forward, which you can do approximately, by counting the same number of 5-mins in a quarter, for example. Once you found the optimal parameters for the previous 4 years, use them for the immediately adjacent subsequent quarter (3 months) out-of-sample. Record the strategy equity changes and trade-by-trade table only for the out-of-sample period. Repeat this process iteratively for all remaining quarters, thus producing a fully out-of-sample equity curve and trade-by-trade table. Measure various statistical performance properties of both equity curve and trade-by-trade table: Average Rate of Return, Standard Deviation of Returns, and the Ratio of the two above (known as the Sharpe or Information Ratio), Total Number of Trades, % of Winners or % of Profitable Trades, Return on the Account (Net Profit to Worst Drawdown), Average Winner, Average Loser, Profit Factor, etc. along with all other characteristics that you will deem useful to gaining insight into the behavior of your market. The quantity and choices of the performance characteristics will make a difference on the grade for your Final Project.
Please, do not forget to keep/save a table with the optimal parameters for each quarter. After you are done with the above experiment you can also solve the in-sample optimization with the whole period being the in-sample length. And calculate its performance characteristics similar to the ones you used above. After you are done, you can compare those to the ones for the out-of-sample experiment and deduce the decay coefficients for various performance measures to estimate the difference or decay of the out-of-sample vs. the in-sample performance for the performance measures you chose.
Variations of the above for the benefit of better results or more interesting outcomes are welcome as well. If you have any questions, please ask!
Finally, once the code is polished, you need to repeat the above procedure for various choices of the in-sample time T (=1,2,3,…,10 years if possible) and out-of-sample time τ (=1,2,3,4 quarters or even =1,2,3…,12 months).
You will be expected to write all your details in the PowerPoint presentation and present your work (using one or several presenters) during 30 mins allocated for that time for each group.
Do not hesitate to ask any question of me or the TA, as well as much of this will be covered during the class.
Good luck!