In teams of at most 2 persons students will build and backtest different trading strategies for 2 groups of assets. Please inform the lecturer about the team members by email pwojcik@wne.uw.edu.pl the latest by midnight 2019-12-10.
The data is exactly the same for all teams and consists of intraday data of in xts
format in 1 minute frequency for group 1 and 5 minute frequency for group 2. The data covers real market quotations of selected futures contracts for the period of 2018-01 – 2019-11 and is divided in 8 quarterly files.
For the purpose of strategy selection and parameters search students are initially given the data just for 4 in-sample quarters (2018Q1, 2018Q4, 2019Q2 and 2019Q3). The remaining data for 4 out-of-sample quarters (2018Q2, 2018Q3, 2019Q1 and 2019Q4) will be delivered by the lecturer after the submission of presentations (see below).
The groups of assets include:
SP
– futures contract for S&P 500 index (transaction cost = 10$, point value = 50$).NQ
– futures contract for NASDAQ index (transaction cost = 10$, point value = 20$).CAD
– futures contract for Canadian dollar (transaction cost = 5$, point value = 100000$).AUD
– futures contract for Australian dollar (transaction cost = 5$, point value = 100000$).XAU
– futures contract for gold (transaction cost = 10$, point value = 100$).XAG
– futures contract for silver (transaction cost = 5$, point value = 5000$).CAUTION: There are separate data files for group 1 and group 2 for each quarter.
Within each of the above groups of assets you can:
If trading more than one asset (spread
), remember to include positive transaction costs for each of them.
Assume trading just with one unit of any security/spread, so the only positions available are:
0
),-1
),+1
).For each of the (groups of) assets please consider and compare at least 2 different types of entry techniques (approaches), each with several combinations of parameters (memories of moving statistics, multipliers, etc.).
As different approaches one may treat (each for the trend following or mean reverting strategy) for example an entry/exit technique based on:
Additional filtering may be added (eg. in pair trading strategies):
Common assumptions for group 1:
9:31-9:45
and 15:46-16:00
) – put missing values there,15:40
),9:31-10:00
), but DO use the data for 9:46-10:00
in calculations of signal, volatility, etc.Common assumptions for group 2:
16:45
),18:15
).One may make additional assumptions, however they should be clearly explained and justified, e.g. stop-loss condition, etc.
CAUTION !!!!! As mentioned before, the data are divided in two parts – in-sample quarters and out-of-sample quarters. At first teams are provided just with the in-sample data to do a research and select the best strategy for each group of assets separately.
Exactly the same strategy (the same entry/exit technique and parameters) has to be applied for a particular group of assets in each quarter.
For example if after research you find that for a particular asset the best strategy is a trend following strategy based on the cross-over of two exponential moving averages – EMA60 and EMA10 – you should apply this particular strategy with the same parameters and all other assumptions to every quarter of your data (first in-sample, then out-of-sample once available) and report the results.
The best/optimal strategy may be different for different assets, but again – it has to be consistently applied on all quarters of data.
Selecting different best strategies (or just different parameters) for the same asset in different quarters of the data is not allowed.
For the selected best strategy for each group of assets aggregate the strategy P&Ls to daily and based on daily results calculate the following measures (separately for each quarter):
and report them in a table at the end of the presentation and report.
Based on the above mentioned measures the final summary statistic will be calculated for each quarter separately. The formula for the summary statistic is the following:
\[stat = (netSR - 0.5) * log(abs(\frac{net.PnL}{1000}))\]
This promotes strategies which give relatively high net Sharpe ratios (above 0.5) and higher net pnl.
Please add this statistic to the summary table and in addition use codes that will save this table as a csv
file.
In the end the sum of the above mentioned summary statistic over all quarters (in-sample and out-of-sample) will be used to rank the teams, divide them in quartile groups and give points for strategy performance.
In total 100 points can be collected, given for:
20 pts
),40 pts
),20 pts
) – ranking based on a summary statistic described above, max. 10 pts.
per each (group) of assets results:
10
if strategy performance in top quartile group (best),7.5
if strategy performance in the 2nd quartile group (good),5
if strategy performance in the 3rd quartile group (below average),2.5
if strategy performance in the 4th quartile group (unlucky),20 pts
)The presentation prepared in RMarkdown has to be submitted by email to the lecturer pwojcik@wne.uw.edu.pl until midnight 2020-01-19 (presentation should be submitted both as the source *.Rmd
file and also in the version compiled to html
or pdf
format). The R codes included in the Rmd
file should load the data from source files for each quarter, apply the BEST finally selected strategy on the data for ALL quarters, calculate P&Ls and report the results in the desired form.
Do NOT include all the testing codes which you applied for strategy selection, parameter search, etc. ONLY a simple code for a FINALLY selected strategy i.e. with the selected set of best performing parameters for each group of assets – check the attached sample
Rmd
files prepared by the lecturer.
All teams will give presentations (10 minutes) informing about strategies considered and their in-sample results. The presentations do not have to inform about all the details of considered strategies.
Only teams that submit presentations in a desired format with working R codes behind will obtain the out-of-sample data. Teams which do not provide
Rmd
file with working R codes behind which apply their best strategies will not be valued.
All presentations will take place on 2020-01-21 (labs time, 11:30-13:05 or 15:00-16:35 in room A102).
Groups that do NOT present their results in class will get 0 points for presentation and for the out-of-sample performance part.
After all the presentations on 2020-01-22 the lecturer will provide the out-of-sample data to enable verifying the strategy performance and finishing a final report. Having prepared the report in R Markdown with working R codes behind will make your analysis of the out-of-sample data very quick and on the other hand would allow the lecturer to verify reported results and check if all assumptions are met.
The final written report should be submitted by midnight 2020-01-26 (report should be submitted both as the source *.Rmd
file and also in the version compiled to docx
format). It should include a detailed explanation of the finally selected strategy for each group of assets (approach, type and elements of the strategy, entry technique, assumptions, parameter values, etc.) and also shortly explain the process of final strategy selection. Measures of strategy performance should also be reported in a table (gross and net SR, gross and net cum P&L, average daily number of trades) together with at least one figure showing gross and net cumulative P&L of the strategy (based on daily aggregated data).
Students who do not submit their final report before the deadline will not be allowed to take the final written exam in winter session.
THE EXAM is planned for 2019-01-29 at 15:00-17:00 in room A203.
Each submission should be done via email to pwojcik@wne.uw.edu.pl before midnight of the deadline day if not stated otherwise.