Analyze trend given a set of points Suppose I have a set of N values representing EUR/USD rate... [ 1.10 , 1.20 , 1.25, 1.20, 1.19 ]
Which is the simplest way for analyzing if values tend to raise or tend to fall?
I'm looking for a simple and computationally efficient algorithm to use and write into a low level programming language like C.
Thanks
 A: Time series data can be complicated.  In addition to any overall trend they can exhibit cyclic behavior over multiple, overlapping seasons; they can suddenly change; they can be driven by other complicated time series; variations around these gross behaviors can have complex random patterns that are correlated over time; and such variation can sometimes include unusually high or low values ("outliers").
For a simple project or in any application where a single estimate of an "overall trend" is desired, it must be made without further analysis of the data, it is understood to be crude, and must be rapidly and easily computed, a highly robust estimate of that trend can be obtained as follows:


*

*Partition the data roughly into thirds according to time.

*Identify the middle (median) dates and median values (USD in this case) in the first and last thirds.

*Use these two points, (median date, median value), to characterize the trend.
One way to use that pair of points is to draw a line through it.  If you possibly can, display the data along with that line so the user can evaluate whether the line is an acceptable summary of the trend.

Notice that the two points used to draw the line--shown as black dots--are not necessarily part of the data.  Each one of them is just a typical value in its third of the time series.
The calculations are simple programming exercises and can be carried out in $O(n)$ time for $n$ data points.
A: Answers will depend partly on what you mean by "tend to rise or fall".
Consider a situation which each period has a 99% chance of small growth (by 1%) and 1% chance of a large drop (a drop to 37% of the previous period's value) - e.g. one typical case: in 100 periods you'll increase 99 times and decrease once, but overall you'll end up down about 1%. 
Does that count as "tend to rise", since you nearly always go up from one period to the next, or does it count as "tend to fall" since in the long run you will tend to end up lower than when you started?
The answer affects how you should measure it. If you think that's "tend to rise" you should look at something like the proportion of rises; if you think that's "tend to fall" you could look at something like the average percentage change (or average change in the logs)... which will tend to be somewhat similar to whuber's approach.
