Best Structure for a Trading Model based on Stock Indices
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Apologies if this sounds very basic but I am completely new to Matlab and would greatly appreciate if someone could let me know if I am on the right track with regard to the data structure I plan to use for my project:
- I plan to generate a model for buying/selling stock indices and tracking the return vs a simple buy and hold strategy. - Inputs are excel sheets with historic end-of-day data (Open, High, Low, Close, Volume) for Dow Jones Industrial Average and Nasdaq Composite. I have also another sheet which contains daily market breadth data such as Advancing issues, Declining issues, etc. - I then plan to calculate several indicators such as MACD, RSI, Moving Averages, On-Balance-Volume (OBV), etc. for every index and day - Based on the above price data and the calculated indicators I want to create specific buy and sell rules. There will be SEVERAL different buy and sell rules and in addition to an overall buy/sell performance for the model I would also like to measure the return of each individual buy or sell rule, max drawdown, etc. For your information, a "sell" would be closed out once any of the "buy" rules gets triggered and vice versa.
Once it's up and running I would like to do statistical testing and be able to play around with adding/removing individual rules or varying certain parameters.
So far I believe the best modeling option would be using the DATASET format (Statistics Toolbox) with the date as the key variable to link the individual sheets. Would you agree or is there a better way to implement the model? How would you create the buy and sell rules? Would you use a separate DATASET for this or just program code?
If anyone has a simple template file for this to learn about the structure or knows where to find one, this would be much appreciated!
Thanks a lot!
0 comentarios
Respuesta aceptada
Leah
el 13 de Feb. de 2012
I prefer to use datasets for all of my data, especially if it is coming from Excel. http://www.mathworks.com/help/toolbox/stats/dataset.html
to bring in the file use
data=dataset('xlsfile',filename.xlsx, 'sheet',sheetname);
It sounds like your sheet name is different for everyday? How is it formatted? Do you then want to join all those individual days into a time series?
2 comentarios
Leah
el 14 de Feb. de 2012
that should be no problem
use join to combine the sheets, you can also specify a join type (full,outer, left, right,inner) since it sounds like they start a
sheet1=dataset('xlsfile',filename.xlsx, 'sheet','sheet1');
sheet2=dataset('xlsfile',filename.xlsx, 'sheet','sheet2');
Data=join(sheet1,sheet2,'type','inner','key','date','mergekeys',true);
you can then add calculated columns like this
Data.HML=Data.high-Data.Low;
Más respuestas (0)
Ver también
Categorías
Más información sobre Transaction Cost Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!