Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Is it possible to automate this type of analysis in MATLAB?

Subject: Is it possible to automate this type of analysis in MATLAB?

From: John

Date: 17 Dec, 2011 23:44:08

Message: 1 of 22

Hello all,

I`m new to this forum and new to MATLAB. I plan on using it for analysis of time series applied to trading of financial instruments and would like to ask for some help to get moving in the right direction.

The first thing I would like to do is to automate a type of analysis that I`ve been plotting in Excel manually at the end of each trading day, but it is very ineffective and difficult to perform if I were to do it across several instruments or for a larger sample going back in time. I will try to explain.

From open to close, 6 1/2 hours per day, the market moves in swings of various size and duration. Up, down, up, down, sequentially.

Using a filter of 35 cents in the crude oil market, I then measure the swings as they occur sequentially throughout the day. I.e., the market would have to reverse more than 35 cents for it to be counted as a new swing.

I measure the length of each swing and the duration of each swing. Example: 1st swing = 71 cents/14 minutes; 2nd swing = 61 cents/35 minutes; 3rd swing = 148 cents/23 minutes, 4th swing = 115 cents/57 minutes, etc.

I also measure at which time of the day a swing is completed, the number of swings every day, the sum of the swings (cents) every day, average swing length/duration, maximum swing per day, minimum swing per day.

I have access to 1-minute (OHLC) intraday data which I assume should be sufficient for this type of analysis.

I was hoping to automate this analysis and find a way to generate a report by the end of each day in a nice spreadsheet or similar.

Can this be done with MATLAB? Any ideas how?

Not asking for any free handouts here, just a push in the right direction. MATLAB is currently a little overwhelming for me and I feel I could need some support. :)

Thanks in advance,

Nelson

Subject: Is it possible to automate this type of analysis in MATLAB?

From: ImageAnalyst

Date: 18 Dec, 2011 00:22:39

Message: 2 of 22

Nelson:
As I'm sure you suspected, the answer is yes, MATLAB can do that - you
just have to write a program for it. Can you say what format your
input data is in? Is it in a text file? What does each line look
like? How comfortable are you with ActiveX programming (to have
MATLAB drive Excel), or would you be able to have an Excel template
and just poke the data in and the Excel template handles plotting the
data as long as it's there in the proper cells?
ImageAnalyst

Subject: Is it possible to automate this type of analysis in MATLAB?

From: dpb

Date: 18 Dec, 2011 00:30:37

Message: 3 of 22

On 12/17/2011 5:44 PM, John wrote:

...[general description of a time series analysis elided for brevity]...

> I have access to 1-minute (OHLC) intraday data which I assume should be
> sufficient for this type of analysis.
> I was hoping to automate this analysis and find a way to generate a
> report by the end of each day in a nice spreadsheet or similar.
> Can this be done with MATLAB? Any ideas how?
...

Sure.

Suck up the data into an array and various operations would be
relatively simple to compute.

For example, given the timeseries of prices as a vector p,

d=diff(p); % gives you the difference in price between observations

It's simple enough then to look at sequences of d>0 and find changes in
slope and compare to the deadband.

For example, if take

d(d>0)=1; d(d<0)=-1;

then

diff(d) % second difference in signs

gives either peak or minimum location as +/-2 (1-(-1))=2 is a maximum
while -1-1=-2 is a minumum. Locating these and whether the difference
in those locations and the first value is outside the tolerance gives
you the locations of all the runs (and thereby the times as well).

All doable in a few vectorized operations w/o having to write any
explicit loops, etc., at all.

And, of course, it can all be put into an m-file (the Matlab insider
talk for functions) and used either manually or automatically.

--

Subject: Is it possible to automate this type of analysis in MATLAB?

From: John

Date: 19 Dec, 2011 00:49:08

Message: 4 of 22

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <64319f0c-7422-496d-a14a-444e9194aaf2@l24g2000yqm.googlegroups.com>...
> Nelson:
> As I'm sure you suspected, the answer is yes, MATLAB can do that - you
> just have to write a program for it. Can you say what format your
> input data is in? Is it in a text file? What does each line look
> like? How comfortable are you with ActiveX programming (to have
> MATLAB drive Excel), or would you be able to have an Excel template
> and just poke the data in and the Excel template handles plotting the
> data as long as it's there in the proper cells?
> ImageAnalyst

Thank you for your reply! I`m glad to hear that it is possible. Not a surprise. =)

I have not yet obtained this data as I am still looking at a few options and caught the flu yesterday delaying my work, but it looks like the option I will choose stores the data tabulated in the ASCII text format in rows with the first row being a header showing Date, Time, Open, High, Low, Close, and the observations in the consecutive rows. I can choose what time format I store it in, but 1-minute observations is the smallest resolution available. Automating the process from my first post is my first goal and then I want to start performing other type of statistical studies on the market.

How I will store and organize this data is yet another puzzle I need to solve. Whether I store everything in a large text file or set up a database in Excel. I will probably have to do some research here to find what is best for my purposes.

Writing a script to automate this process was what I had in mind and I have already been doing some very basic stuff following along in some of the tutorials. I got MATLAB just a few days ago and I have no prior programming experience, so I have to disappoint you with regards to ActiveX. =)

I really could not be able to answer whether I want MATLAB to run Excel or the other way around with a template. I may not even need to integrate it with Excel? I just want to find an easy way to do this on a daily basis, even if it may involve a lot of work to do the initial work and preparations. One thing is that I would like to store my daily observations or even collect the statistics for this type of analysis going back in time in an easily accessible format. I imagine setting up a database in Excel may be the easiest way, although I`m really not sure and open for exploring this further.

Thanks again,

Nelson

Subject: Is it possible to automate this type of analysis in MATLAB?

From: John

Date: 19 Dec, 2011 00:54:09

Message: 5 of 22

dpb <none@non.net> wrote in message <jcjc7e$jtc$1@speranza.aioe.org>...
> On 12/17/2011 5:44 PM, John wrote:
>
> ...[general description of a time series analysis elided for brevity]...
>
> > I have access to 1-minute (OHLC) intraday data which I assume should be
> > sufficient for this type of analysis.
> > I was hoping to automate this analysis and find a way to generate a
> > report by the end of each day in a nice spreadsheet or similar.
> > Can this be done with MATLAB? Any ideas how?
> ...
>
> Sure.
>
> Suck up the data into an array and various operations would be
> relatively simple to compute.
>
> For example, given the timeseries of prices as a vector p,
>
> d=diff(p); % gives you the difference in price between observations
>
> It's simple enough then to look at sequences of d>0 and find changes in
> slope and compare to the deadband.
>
> For example, if take
>
> d(d>0)=1; d(d<0)=-1;
>
> then
>
> diff(d) % second difference in signs
>
> gives either peak or minimum location as +/-2 (1-(-1))=2 is a maximum
> while -1-1=-2 is a minumum. Locating these and whether the difference
> in those locations and the first value is outside the tolerance gives
> you the locations of all the runs (and thereby the times as well).
>
> All doable in a few vectorized operations w/o having to write any
> explicit loops, etc., at all.
>
> And, of course, it can all be put into an m-file (the Matlab insider
> talk for functions) and used either manually or automatically.
>
> --

Thank you very much! That gave me some ideas and I even believe I understood a little of what you just wrote, which is a compliment to you as this is all really way above my head. =)

I already wrote a basic m-file following along some of the tutorials at Mathworks, so I understand the basic gist of it. If I can write the code, I can just store it as an m-file.

Thanks again. I may have to ask for some advice later on after I start working with this if that is okay.

Subject: Is it possible to automate this type of analysis in MATLAB?

From: TideMan

Date: 19 Dec, 2011 02:55:05

Message: 6 of 22

On Dec 19, 1:49 pm, "John " <esotericknowle...@hotmail.com> wrote:
> ImageAnalyst <imageanal...@mailinator.com> wrote in message <64319f0c-7422-496d-a14a-444e9194a...@l24g2000yqm.googlegroups.com>...
> > Nelson:
> > As I'm sure you suspected, the answer is yes, MATLAB can do that - you
> > just have to write a program for it.  Can you say what format your
> > input data is in?  Is it in a text file?  What does each line look
> > like?  How comfortable are you with ActiveX programming (to have
> > MATLAB drive Excel), or would you be able to have an Excel template
> > and just poke the data in and the Excel template handles plotting the
> > data as long as it's there in the proper cells?
> > ImageAnalyst
>
> Thank you for your reply! I`m glad to hear that it is possible. Not a surprise. =)
>
> I have not yet obtained this data as I am still looking at a few options and caught the flu yesterday delaying my work, but it looks like the option I will choose stores the data tabulated in the ASCII text format in rows with the first row being a header showing Date, Time, Open, High, Low, Close, and the observations in the consecutive rows. I can choose what time format I store it in, but 1-minute observations is the smallest resolution available. Automating the process from my first post is my first goal and then I want to start performing other type of statistical studies on the market.
>
> How I will store and organize this data is yet another puzzle I need to solve. Whether I store everything in a large text file or set up a database in Excel. I will probably have to do some research here to find what is best for my purposes.
>
> Writing a script to automate this process was what I had in mind and I have already been doing some very basic stuff following along in some of the tutorials. I got MATLAB just a few days ago and I have no prior programming experience, so I have to disappoint you with regards to ActiveX. =)
>
> I really could not be able to answer whether I want MATLAB to run Excel or the other way around with a template. I may not even need to integrate it with Excel? I just want to find an easy way to do this on a daily basis, even if it may involve a lot of work to do the initial work and preparations. One thing is that I would like to store my daily observations or even collect the statistics for this type of analysis going back in time in an easily accessible format. I imagine setting up a database in Excel may be the easiest way, although I`m really not sure and open for exploring this further.
>
> Thanks again,
>
> Nelson

Excel is a spreadsheet program, not a database.
If you're planning to just play with a few data points then Excel is
fine, but if you're expecting to deal with serious quantities of data,
then Excel is a poor choice.
A better option is netCDF which is built-in in modern versions of
Matlab.

Subject: Is it possible to automate this type of analysis in MATLAB?

From: ImageAnalyst

Date: 19 Dec, 2011 04:11:30

Message: 7 of 22

On Dec 18, 7:49 pm, "John " <esotericknowle...@hotmail.com> wrote:
> I have not yet obtained this data as I am still looking at a few options and caught the flu yesterday delaying my work, but it looks like the option I will choose stores the data tabulated in the ASCII text format in rows with the first row being a header showing Date, Time, Open, High, Low, Close, and the observations in the consecutive rows.[snip]
>
> Nelson
-------------------------------------------------------------------------------------------------------
You might be interested in csvread, or dlmread, or textscan.

Subject: Is it possible to automate this type of analysis in MATLAB?

From: Rune Allnor

Date: 19 Dec, 2011 06:06:27

Message: 8 of 22

On 18 Des, 00:44, "John " <esotericknowle...@hotmail.com> wrote:
> Hello all,
...
> Can this be done with MATLAB? Any ideas how?
>
> Not asking for any free handouts here, just a push in the right direction. MATLAB is currently a little overwhelming for me and I feel I could need some support. :)

This can certainly be done, but be prepared for some
intricate logic.

There are a couple of details you might want to sort
out, before attempting to code this up:

- When you say '35c up or down', do you mean from the
  last switch, or from the lowest/highets data point
  in the period?

Might seem as nit-picking, but will be essential for
how to actually implement this.

Rune

Subject: Is it possible to automate this type of analysis in MATLAB?

From: Rune Allnor

Date: 19 Dec, 2011 11:16:50

Message: 9 of 22

On 19 Des, 07:06, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 18 Des, 00:44, "John " <esotericknowle...@hotmail.com> wrote:
>
> > Hello all,
> ...
> > Can this be done with MATLAB? Any ideas how?
>
> > Not asking for any free handouts here, just a push in the right direction. MATLAB is currently a little overwhelming for me and I feel I could need some support. :)
>
> This can certainly be done, but be prepared for some
> intricate logic.
>
> There are a couple of details you might want to sort
> out, before attempting to code this up:
>
> - When you say '35c up or down', do you mean from the
>   last switch, or from the lowest/highets data point
>   in the period?
>
> Might seem as nit-picking, but will be essential for
> how to actually implement this.
>
> Rune

Acually, I found that task a bit interesting.
Here is one first attempt at an implementation:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [chidx chdir] = findChanges(x,dx)
% x is a vector containing the raw data values
% dx is the threshold on the change (35c in thios case)
%
% chidx is a cvector containing the indexes where
% changes are detected
% chdir indicates the direction of the chand,
% +1 for 'up', -1 for 'down'.

% Changes are relative to the max /min values inside
% the interval.

i1=2;
N = length(x);
xmax = x(1);
xmin = x(1);

chidx =[];
ChDir = [];

for i1 = 1:N
        xmax = max(x(i1),xmax);
        xmin = min(x(i1),xmin);
        if xmax-x(i1) > dx
            ChIdx = -1;
            xmax = x(i1);
            xmin = x(i1);
        end
        if x(i1) - xmin > dx
            ChIdx = 1;
            xmax = x(i1);
            xmin = x(i1);
        end
end

if nargout > 1
    chdir = ChDir;
end

Subject: Is it possible to automate this type of analysis in MATLAB?

From: dpb

Date: 19 Dec, 2011 15:14:01

Message: 10 of 22

On 12/19/2011 12:06 AM, Rune Allnor wrote:
...

> This can certainly be done, but be prepared for some
> intricate logic.
>
...

It's a local min/max problem (w/ appropriate screening criteria, granted).

I'd suggest OP do a search on the File Exchange for "local minima"
and/or brows signal/image processing submissions. There are quite a
number of good implementations that if nothing else are learning tools
if not the final solution.

<http://www.mathworks.com/matlabcentral/fileexchange>
<http://www.mathworks.com/matlabcentral/fileexchange/?term=local+minima>

--

Subject: Is it possible to automate this type of analysis in MATLAB?

From: Rune Allnor

Date: 19 Dec, 2011 16:00:33

Message: 11 of 22

On 19 Des, 16:14, dpb <n...@non.net> wrote:
> On 12/19/2011 12:06 AM, Rune Allnor wrote:
> ...
>
> > This can certainly be done, but be prepared for some
> > intricate logic.
>
> ...
>
> It's a local min/max problem (w/ appropriate screening criteria, granted).

Sure, you know that and I know that.
But judging from the post, the OP does
likely not have any previous programming
experience. In that case, *any* logic is
intricate.

Rune

Subject: Is it possible to automate this type of analysis in MATLAB?

From: dpb

Date: 19 Dec, 2011 17:30:51

Message: 12 of 22

On 12/19/2011 10:00 AM, Rune Allnor wrote:
> On 19 Des, 16:14, dpb<n...@non.net> wrote:
>> On 12/19/2011 12:06 AM, Rune Allnor wrote:
>> ...
>>
>>> This can certainly be done, but be prepared for some
>>> intricate logic.
>>
>> ...
>>
>> It's a local min/max problem (w/ appropriate screening criteria, granted).
>
> Sure, you know that and I know that.
> But judging from the post, the OP does
> likely not have any previous programming
> experience. In that case, *any* logic is
> intricate.

All the more reason to look at previous solutions as guideposts.

--

Subject: Is it possible to automate this type of analysis in MATLAB?

From: John

Date: 19 Dec, 2011 23:13:07

Message: 13 of 22

TideMan <mulgor@gmail.com> wrote in message <639cc201-8caf-473e-86ef-25864f42b0c7@l24g2000yqm.googlegroups.com>...
> Excel is a spreadsheet program, not a database.
> If you're planning to just play with a few data points then Excel is
> fine, but if you're expecting to deal with serious quantities of data,
> then Excel is a poor choice.
> A better option is netCDF which is built-in in modern versions of
> Matlab.

Thank you for your informative reply. Admittedly, I have not yet done too much research on this area and I only recall reading about people using it as a database, but I suspect that may have been with smaller datasets.

If I want to store 1-minute data tabulated in rows, that would be 93 600 rows for one single year. 468 000 for 5 years (which should be a sufficient intraday sample). I will only do this for one instrument to start, but it is clearly a lot of data already.

So yes, this is probably overkill for Excel, not to mention that the database will be growing. Another stupid question. Do I need a database? I have heard a few people who organizes all their work in simple text files. What are the advantages of a database? I assume that it is an easier way to organize the data compared to text files and that I could store my statistical analysis in the same framework.

I will do a search on netCDF. Thank you. Considering my limitations as a programmer, I would appreciate something that is fairly within my reach to learn. Is Microsoft Access something to consider? I recall seeing it in a MATLAB tutorial here at Mathworks. The price is at least affordable and the user interface seems within reach.

All information is highly appreciated.

Thanks again,

Nelson

Subject: Is it possible to automate this type of analysis in MATLAB?

From: John

Date: 19 Dec, 2011 23:21:08

Message: 14 of 22

Rune Allnor <allnor@tele.ntnu.no> wrote in message <c3bfb942-5ce4-4fa9-8572-dffc766f8980@z1g2000vbx.googlegroups.com>...
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> function [chidx chdir] = findChanges(x,dx)
> % x is a vector containing the raw data values
> % dx is the threshold on the change (35c in thios case)
> %
> % chidx is a cvector containing the indexes where
> % changes are detected
> % chdir indicates the direction of the chand,
> % +1 for 'up', -1 for 'down'.
>
> % Changes are relative to the max /min values inside
> % the interval.
>
> i1=2;
> N = length(x);
> xmax = x(1);
> xmin = x(1);
>
> chidx =[];
> ChDir = [];
>
> for i1 = 1:N
> xmax = max(x(i1),xmax);
> xmin = min(x(i1),xmin);
> if xmax-x(i1) > dx
> ChIdx = -1;
> xmax = x(i1);
> xmin = x(i1);
> end
> if x(i1) - xmin > dx
> ChIdx = 1;
> xmax = x(i1);
> xmin = x(i1);
> end
> end
>
> if nargout > 1
> chdir = ChDir;
> end

Hello Rune and thank you for your reply. Are you Norwegian by the way? =)

It is important to be a nitpicker with such tasks, since precision is imperative. The swing high or low will always be made either on the high or low reading. Occassionally, the high or low reading is the same as the open/close, but always the high/low I assume, so that should be the only variables (high/low) needed.

Thank you for your attempt at solving my problem. Interesting. I will need to give it study. I`m still lying flat out in bed with bronchitis and the flu, so I will not have the opportunity to sit down and really work with this in a while, but it seems like I have a great starting point already. Tusen takk! =)

Regards,

Nelson

Subject: Is it possible to automate this type of analysis in MATLAB?

From: John

Date: 19 Dec, 2011 23:27:08

Message: 15 of 22

dpb <none@non.net> wrote in message <jcnkbo$dao$1@speranza.aioe.org>...
> It's a local min/max problem (w/ appropriate screening criteria, granted).
>
> I'd suggest OP do a search on the File Exchange for "local minima"
> and/or brows signal/image processing submissions. There are quite a
> number of good implementations that if nothing else are learning tools
> if not the final solution.
>
> <http://www.mathworks.com/matlabcentral/fileexchange>
> <http://www.mathworks.com/matlabcentral/fileexchange/?term=local+minima>

Thank you very much, dpb.

Not in a position to do any serious study at the moment, but judging from your links that certainly seems to be a push in the right direction.

It is correct that I am flat out clueless with regards to programming, but I hope to improve that. I have been thinking a little about how to approach my learning in MATLAB. I received this book today: http://www.amazon.com/Matlab-Second-Practical-Introduction-Programming/dp/0123850819/ref=sr_1_3?ie=UTF8&qid=1324337024&sr=8-3

Working through this one from start to finish should at least give me a basic understanding. I wonder if that would be smart to do before resuming to solve my current "problems" or if I could just jump right into it. I don`t want to waste too much time on stuff that I don`t need, although any experience with using the software will probably help me on my way to MATLAB mastery. Any advice on how to approach this as well is welcome. =)

Thanks,

Nelson

Subject: Is it possible to automate this type of analysis in MATLAB?

From: dpb

Date: 19 Dec, 2011 23:55:46

Message: 16 of 22

On 12/19/2011 5:27 PM, John wrote:
...
> It is correct that I am flat out clueless with regards to programming,
> but I hope to improve that. I have been thinking a little about how to
> approach my learning in MATLAB. I received this book today:
> http://www.amazon.com/Matlab-Second-Practical-Introduction-Programming/dp/0123850819/ref=sr_1_3?ie=UTF8&qid=1324337024&sr=8-3
>
>
> Working through this one from start to finish should at least give me a
> basic understanding. I wonder if that would be smart to do before
> resuming to solve my current "problems" or if I could just jump right
> into it. I don`t want to waste too much time on stuff that I don`t need,
> although any experience with using the software will probably help me on
> my way to MATLAB mastery. Any advice on how to approach this as well is
> welcome. =)
...

I find it hard to visualize actually starting from absolute scratch any
longer. I'm of the age that learning programming basics for me began w/
coding FORTRAN manually on coding forms and then "executing" each
others' in the class programs manually as time on the mainframe wasn't
allowed for undergraduates except on a very limited basis. After we
successfully (for some definition of "success" :) ) had gone through an
exercise of four or five small programs, then as a class final we
actually punched and submitted a program and got the results back. As I
recall, there was one resubmittal in there...needless to say, not many
had a fully bug-free run. :)

I'd suggest starting w/ the online documentation "Getting Started"
section and then perhaps use the book some. That should get you to the
basic idea. But, the task you've outlined is sizable simply owing to
the amount of data (but, of course, you can test algorithms on very much
smaller subsets), and the major portion will probably end up being
working out how much and how to store the data. You may want to rethink
whether it makes sense to actually save all the data or not. Of course,
you can do much more space-saving things than saving it as text files.
Data bases aren't so much great for that (altho they can help); their
primary reason is for access to pieces of the data by keys or searches.
  It seems to me from the problem description that really would be a
small fraction of what you would need.

--

Subject: Is it possible to automate this type of analysis in MATLAB?

From: Rune Allnor

Date: 20 Dec, 2011 02:41:26

Message: 17 of 22

On 20 Des, 00:21, "John " <esotericknowle...@hotmail.com> wrote:
> Rune Allnor <all...@tele.ntnu.no> wrote in message <c3bfb942-5ce4-4fa9-8572-dffc766f8...@z1g2000vbx.googlegroups.com>...

Some obvious corrections:

> > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > function [chidx chdir] = findChanges(x,dx)
> > % x  is a vector containing the raw data values
> > % dx is the threshold on the change (35c in thios case)
> > %
> > % chidx is a cvector containing the indexes where
> > %       changes are detected
> > % chdir indicates the direction of the chand,
> > %       +1 for 'up', -1 for 'down'.
>
> > % Changes are relative to the max /min values inside
> > % the interval.

> > N = length(x);
> > xmax = x(1);
> > xmin = x(1);
>
> > chidx =[];
> > ChDir = [];

i2 = 1;

> > for i1 = 1:N
> >         xmax = max(x(i1),xmax);
> >         xmin = min(x(i1),xmin);
> >         if xmax-x(i1) > dx

> >             ChIdx(i2) = -1;

> >             xmax = x(i1);
> >             xmin = x(i1);

                i2 = i2 +1;

> >         end
> >         if x(i1) - xmin > dx

> >             ChIdx(i2) = 1;

> >             xmax = x(i1);
> >             xmin = x(i1);

                i2= i2+1;

> >         end
> > end
>
> > if nargout > 1
> >     chdir = ChDir;
> > end

Rune

Subject: Is it possible to automate this type of analysis in MATLAB?

From: John

Date: 10 Feb, 2012 11:03:13

Message: 18 of 22

Hello all,

Thank you for all earlier help and suggestions.

It seems like I do not have the necessary time to learn MATLAB until next fall, since I`m currently very busy with mathematical studies and my day job. I expect my mathematical studies to help me better learn MATLAB next fall, but until then I don`t think I will attempt this project on my own.

Do you guys know of any places where I can hire a programmer for this project?

Now that I need to hire someone, are there other programs or languages that are better for this analysis or should I stick to MATLAB? What about Excel VBA?

In addition to automating this type of analysis, I would like to add in some basic statistical analysis and queries. I want a running 5,10,20-day average range of the trading session, median range, maximum range, minimum range, number of up/down days, average return after 2 days down, maximum consecutive number of down/up days, etc.

All this that I mentioned in the last paragraph is stuff that I could probably figure out on my own if I tabulate my data in Excel or some other database.

I want to streamline this process and make it as easy as possible, preferrably integrating everything in one program or send it all to one spreadsheet/report sheet that is updated on a daily basis.

Thanks in advance for any help and suggestions.

Kind regards.

Subject: Is it possible to automate this type of analysis in MATLAB?

From: Marc

Date: 15 Feb, 2012 04:39:16

Message: 19 of 22

"John" wrote in message <jh2thh$5vq$1@newscl01ah.mathworks.com>...
> Hello all,
>
> Thank you for all earlier help and suggestions.
>
> It seems like I do not have the necessary time to learn MATLAB until next fall, since I`m currently very busy with mathematical studies and my day job. I expect my mathematical studies to help me better learn MATLAB next fall, but until then I don`t think I will attempt this project on my own.
>
> Do you guys know of any places where I can hire a programmer for this project?
>
> Now that I need to hire someone, are there other programs or languages that are better for this analysis or should I stick to MATLAB? What about Excel VBA?
>
> In addition to automating this type of analysis, I would like to add in some basic statistical analysis and queries. I want a running 5,10,20-day average range of the trading session, median range, maximum range, minimum range, number of up/down days, average return after 2 days down, maximum consecutive number of down/up days, etc.
>
> All this that I mentioned in the last paragraph is stuff that I could probably figure out on my own if I tabulate my data in Excel or some other database.
>
> I want to streamline this process and make it as easy as possible, preferrably integrating everything in one program or send it all to one spreadsheet/report sheet that is updated on a daily basis.
>
> Thanks in advance for any help and suggestions.
>

Everything you want to do can be done very elegantly in Matlab.

You may want to contact the Mathworks to get pricing on what it would cost for one of their application engineers to take a look.

The basic Matlab package with th Stats toolbox will probably be all you need.

If you are serious about data storage and potentially data compression then the database toolbox combined with maybe an oracle db or access would do the trick.

Once you have the data in Matlab, assuming you had someone else handle all of the up front programming, it will be very easy for you to then further manipulate and visualize the data outside of your previously stated requests.

Good luck.....

Subject: Is it possible to automate this type of analysis in MATLAB?

From: Marc

Date: 15 Feb, 2012 04:54:20

Message: 20 of 22

I should of prefaced that I currently work with an excel/VBA/oracle db as an end user.

We work with 5 second data and hourly compressions. There is a lot of maintenance that goes on behind the scenes by many FT employees to maintain this.

I bypass this with Matlab.

Off course I cheat since I do not have to maintain the DB.

So to be fair, you can plot, automate and do everything you want to do with Excel 2007/VBA/some database.

But then you are stuck with Excel as your front end analysis tool.

There are also some neat financial toolboxes. I do not have any experience with these but they may have some built in functions already available to do what you want to do.

Subject: Is it possible to automate this type of analysis in MATLAB?

From: John

Date: 7 Mar, 2012 17:17:22

Message: 21 of 22

> Everything you want to do can be done very elegantly in Matlab.
>
> You may want to contact the Mathworks to get pricing on what it would cost for one of their application engineers to take a look.
>
> The basic Matlab package with th Stats toolbox will probably be all you need.
>
> If you are serious about data storage and potentially data compression then the database toolbox combined with maybe an oracle db or access would do the trick.
>
> Once you have the data in Matlab, assuming you had someone else handle all of the up front programming, it will be very easy for you to then further manipulate and visualize the data outside of your previously stated requests.
>
> Good luck.....

Marc,

Thank you very much for your input.

I sent a request to Mathworks, so I`m waiting to hear from them, although I fear that the price is too much for a lone guy like me with a budget.

I see that there are several programmers offering their services on the internet for a reasonable price, so maybe that is a better choice.

Basically, I need help to automate collection of the swing statistics. I would like to look at the last 3 years as a minimum.

In addition to that, I want statistics such as the daily range, maximum/minimum/mean/median daily range, 10-20-30 day average, number of up/down days, etc.

I also want the opportunity to easily investigate the data. For example, after three strong days of upmovement, was there any pattern for the 4th day in recent history, say the last 5 occurrences?

I also would like to make fast queries like in this example: This Monday is so far gap down when the previous close was also down. On the last 4 occasions of Mondays gap down with the previous close down, the Close on the day was in a range of 20 to 165 points down on the Opening Price (9.30am YM).

I would like to organize all of this in a system that is easy to maintain and use and that I can grow with, but I realize that I need help to do so.

I assume that setting up the data in a database would be a good idea, but there are many people who say that they only work with the txt files separately and think that works fine.

Thanks again,

John

Subject: Is it possible to automate this type of analysis in MATLAB?

From: Konstantinos salasasoglou

Date: 30 Aug, 2012 18:42:08

Message: 22 of 22

Hi John ,i'm currently in the same spot as you was earlier this year,i need roughly the same type of analysis and looking to take advantage of the capabilities of Matlab,any jumpstart advice how to move forward?
your help is deeply appreciated!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us