# Thread: Direction of series of numbers

1. ## Direction of series of numbers

Hi All,

Probably a really easy question for you guys but I am NO maths guru

I have a database with a numbers like "5678.33" in it, this number goes up and down, how can I determines its direction over time (daily)?

T=Time
N=Number
T/N = Direction

Thanks

Steve

2. ## Re: Direction of series of numbers

I guess you're looking for the trend? If so, you can just plot the data in Excel or some other software and get the trend line.

I took the adjusted close from 08/19/2004 to 0/09/2011, plotted it, and then fit a trend line against it.

3. ## Exactally what I'm looking for, but

HI downthesun01,

Yes that is what I am looking for but I want to program it in VB, does anyone know the forumla?

Steve

4. ## Re: Direction of series of numbers

Yes, but it's not fun to do.

$\hat{y}_{t}=b_{0}+b_{1}t$

That's the equation for the trend line.

Calculating $b_0$ and $b_1$ is where it gets tricky.

$b_{1}=\frac{SS_{ty}}{SS_{tt}}=\frac{\sum^{n}_{t=1} ty_{t}-\frac{(\sum^{n}_{t=1}t)(\sum^{n}_{t=1}y_{t})}{24}} {\sum^{n}_{t=1}t^{2}-\frac{(\sum^{n}_{t=1}t)^{2}}{24}}$

$b_{0}=\bar{y}-b_{1}\bar{t}=\frac{\sum^{n}_{t=1}y_{t}}{24}-b_{1}\frac{\sum^{n}_{t=1}t}{24}$

n is the the amount of data you have. So if you have 40 if you have 40 entries, 100 if you have 100 entries, etc.

t is time with beginning with your first entry, so t=(1,2,3,...,n)

I hope that all makes sense.

5. ## Re: Direction of series of numbers

Hi again downthesun01,

Well I get a few bits of the equation but far from all of it! is there any way you can do an example sum with just three numbers in it? I think this might help me understand

Thanks

Steve

6. ## Re: Direction of series of numbers

Hi all,

THinking about this problem again there might be a better way of getting what I want, what I really want to know is if the ftse is going up or down (say without a 30min period) I do not actaully need a trendline as such.

Thanks

Steve

7. ## Re: Direction of series of numbers

Here you go. I did a 5 number example and attached it as a .pdf for you.

8. ## Re: Direction of series of numbers

Originally Posted by scarr
Hi all,

THinking about this problem again there might be a better way of getting what I want, what I really want to know is if the ftse is going up or down (say without a 30min period) I do not actaully need a trendline as such.

Thanks

Steve
Divide your data into two equal parts, discard the central point if you have an odd number of data points.

Calculate the mean for the two parts. Your data is rising if the mean second half is larger than that of the first and vice-versa

CB

9. ## Re: Direction of series of numbers

You could just calculate b1. If b1>0 then your data is increasing. B1<0 and the data is decreasing