[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
Solved

stock filtering / mathematical formulas

Posted on 2012-09-04
Medium Priority
445 Views
I have a program which contains a stocks/equities universe of 1,000 odd securities and the daily stockprice data associated with those companies for the last few years.

Can anyone think of a mathematical formular which I can use to program to certain for annual cyclical periods of growth and decline.

For example: Company X every year for the last few years increase in share price around (but not exactly the same day or week) the 3rd week of June slowly increasing and leading up to the company's annual general meeting or financial results around end of July.

In actual fact there are two questions here, one is where a defined period is know i.e. tell the software to search one particular stock on one particular month over X number of years but the harder question is how to tell the system to detect several companies out of the database for certain periods of "cyclical growth" each year for the last few years.

Any thoughts?
0
Question by:u587162
• 3
• 3
• 2

LVL 13

Accepted Solution

Ryan earned 750 total points
ID: 38363331
It sounds to me like you could use a running average of say 5 days initially, trying to find a "significant" trend (>5% increase in value over x days?). Assuming you start from some initial time, moving forward, once you find a trend, you then hold your first point, and expand your ending point until the trend ends.  Then store your starting and ending points of that trend and move on to find more.

Now you have a list of stocks and periods they trend.

Now rerun a new method over those trends, looking repeats every 52weeks +- 3weeks maybe?  Flag those data points for manual review.
0

LVL 13

Expert Comment

ID: 38363349
Generics are really simple, just don't confuse them with polymorphism, they're simpler than that.  Given a generic T, it must be T, where as in polymorphism, a string or any class are also their inherited class like Objects, T is just T whatever it is defined as by the calling functions passed variable.

Sounds so much clearer in my head than when I try to type it.
0

LVL 1

Author Comment

ID: 38363368
urgh, yeah?!

You're talking to a non quntitative person, so your last comment went straight over my head.

on your first comment however(!), how can I break that down in more simpler english to save someone program for me using (I dont know even know what code to suggest other than its called Metastock code - from Equis - but thats too detailed).  Excel code?
0

LVL 37

Assisted Solution

TommySzalapski earned 750 total points
ID: 38363436
The second comment from Mr Bullwinkle was accidentally posted in this question and clearly belongs in a thread about object oriented programming. Pay no attention to it. It was not intended for this topic.

First, a side note: Using statistical models to predict stocks is dangerous because there are so many things that affect it that won't be in your model (press releases, new CEOs, inventions, etc). If it was easy to make lots of money doing so, everyone would do it and then it wouldn't work any more anyway. This is a fairly basic question. If you can't solve it yourself, then you aren't going to make tons of money playing the market with statistics (no offence of course, that's just how it is).

Okay. If you are specifically looking for yearly cycles, then one easy way to start would be to count the number of years in which that month was higher than the previous and following months. Then divide that by the total number of years to get the percent of time that the month was higher. You could weight that somewhat by using how much higher it was.
0

LVL 13

Expert Comment

ID: 38363821
Yes, sorry about the 2nd post. Not sure how that crossed, or how to delete it now.

I didn't realize you weren't trying to use code. Excel does have some functions for finding trends in data, but I never use them unless someone else has already started, so I can't suggest anything that route, but keep in mind, you're asking about processing a lot of data, so you shouldn't expect a simple set of formula in excel to do it for you. And certainly as you try and fine tune it, I would expect you'll need to rewrite functionality.

Certainly Tommy has very valid points. If it were as easy as a simple cycle, everyone would do it, but its not my money or project.
0

LVL 1

Author Comment

ID: 38363951
The stockmarket program I use (one of industry standard type) uses excel language to running a filter e.g. show me stocks where the closing price is 5% greater than the previous closing price "C>5%"
0

LVL 1

Author Comment

ID: 38363954
Tommy - thanks for your posting.  You're talking to someone who is a professional trader trading forex and stocks for the last 20 years, so I'm familiar how the markets work and have been fairly successful from it.

The question is not about what moves the markets nor fundamental analysis v technical analysis (both of which I favour, more the second the first and have done considerably well out of "trading the market" using technical indicators rather than buying and holding.  Buffet has done well, but I dont have the luxury of buying, holding for 40 years and waiting for my return, this is my day job, flow of transactions, all short terms, take profits where I can and use research to help increase the probability of short term success.
0

LVL 37

Expert Comment

ID: 38368176
Oh, I certainly wasn't saying you have to hold on to stocks for years to make money, just that using computer prediction based solely on the shapes of the graphs isn't going to be very effective. It definitely can help you filter some stuff though.

If you are processing large amounts of data (tens of thousands or more) then you'll want to learn something other than Excel like C++ or another compiled language. Excel is good for what you are doing though I think.
0

Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When we purchase storage, we typically are advertised storage of 500GB, 1TB, 2TB and so on. However, when you actually install it into your computer, your 500GB HDD will actually show up as 465GB. Why? It has to do with the way people and computers…
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Suggested Courses
Course of the Month19 days, 19 hours left to enroll