Option Trading Blog




How To Test For a Trend

It seems that all the websites about trading focus on the same Technical Analysis. I know why people find it appealing though. It is damn EASY. But I do believe it is pseudo science at best.

The problem though, is that it seems there aren’t any alternatives other than Technical Analysis to people out there. And if there are, they seem pretty darn hard complicated.

One overlooked technique is the use of statistics. Statistical methods are widely used actually in the world of speculating and trading but RARELY used with beginners. I think this stems from the fact that there are about a MILLION books covering Technical Analysis and not too many covering statistical methods in finance. The ones who do, have their own jargon and you need to cover a lot of background material to understand what is going on.

I want to present here a simple statistical method you can perform in your excel sheet which tests for a trend. You are probably saying right now “Hey! This is going to get complicated! I did not study statistics”. Please bare with me. If there is a concept which is math related and intuitive to everybody, it is statistics.

Note: I do not intend to cover this method rigorously. Just enough to get you working with it.

Concepts are best understood with examples. Suppose we take the last closing prices of the S&500 index

X(1) = 1,445.94, X(2)=1,448.39, X(3)=1,445.94, X(4)=1,448.39, X(5)=1,446.99, X(6)=1,448.00, X(7)=1,450.02, X(8)= 1,448.31, X(9)=1,438.06, X(10)=1,433.37, X(11)=1,444.26, X(12)=1,455.30, X(13)=1,456.81

These are the last 13 closing prices of the S&P 500 where t he last one, X(13), is the last closing price. That means that X(1) was the closing price 13 days ago. So the progression is from last days until this day.

We will now create another set of data by taking the difference of each neighboring price with yesterday’s price (be careful not doing the opposite) and assigning the value ‘1′ if it is a positive difference and ‘0′ if it is negative. Of course we encounter a problem since the closing price 13 days ago has no price from yesterday (14 days ago) because we have started to collect data only later. So we won’t compute any value for it and just start from the next one

U(1) = X(2)-X(1)=1 (1448.39-1,445.94>0), U(2)=X(3)-X(2)=0 (1,445.94-1,448.39<0), U(3)=1,U(4)=0, U(5)=1, U(6)=1, U(7)=0, U(8)=0, U(9)=0, U(10)=1, U(11)=1, U(12)=X(13)-X(12)=1 (1,456.81-1,455.30>0).

So far so good. What do we do with this? Well, since we only have zero’s and one’s, this is also known as a binomial distribution, meaning that there are only two values. So the neat thing about the binomial distribution is that we can play with it and compute probabilities with it.

Let’s sum all the 1’s from the differences and call this sum S.

S=7 in our case. Now, this sum has a nice property, that with big enough historical prices (more than 30 as a rule of thumb), you could test for a trend. We only took 13 prices which gave us only 12 differences. We would need to take at least 31 prices to have 30 differences to make this test accurate but this is just an example.

To proceed, take the sum S (which equals 7 in our case), subtract the number of historical prices you took divided by 2 (in our case 13/2 = 6.5) and divide the result by the square root of the number of historical prices divided by 4. Thus dividing by the square root of 13/4. This all amounts 0.27.

The equation looks like this: (S - N/2) / Squareroot(N/4), where N stands for the number of closing prices we took. Don’t get confused in the order. The nominator is the S-N/2, so first compute this. Then take the answer and divide by the square root of N/4.

The final number is what is important in all of this. The more it gets closer to ‘0′ the less it means you have a trend. But close and far are subjective. We need to compute probabilities. Go to excel, and in the insert->function, chose catageroy ‘Statistical‘ and chose the function below : NORMSDIST. In the slot just put the number 0.27 we got.

You’d get the number 0.609244. What do you do with this number? Substract it from 1 and you’d roughly get 0.4. This is what matters in the end. 0.4 means there is 40% probability this is not a trend. Is that good or bad? Well in statistics it is considered bad. What you are aiming for is less than 0.05! so the 0.4 is way bigger than 0.05 and we conclude there is not a trend.

That is it folks. This will give you some indication to test for a trend. It is pretty easy once you get used to it. Of course remember to always take more than 30 prices. Also, we have used daily closing prices but you could also take 30 intra day prices in time intervals you chose. It all depends on the scope of your trading. Also remember to subtract the number you get from excel from ‘1′. This is the final answer you are looking for to determine the probabilities!

Please comment me or send me an email if something is not clear in this so I could make this post better!

Doing this with excel:

Just put the details of the stock in one column, and then go to the next column and down one slot. There, press the insert button->function->if. You will see 3 slots. In the first, write A2-A1>0 (only if you put it in the first slot in the first column, so change accordingly). In the second write ‘1′. In the 3rd write ‘0′ and voila it computed it automatically in the second column! Now, to do this for all the data just drag your mouse to the bottom right of the box in which excel had assigned the value ‘0′ or ‘1′. You will see the cursor changing into a black cross. Press this and drag it down in the column to the last data you wish to compute the difference and it will do it automatically for all the other data!

Now that you have computed all the difference, to compute with excel the sum quickly just go to the insert->function as before and chose the function SUM. Then, just drag the mouse on all the differences and it will compute the sum.

If you liked this post, buy me a beer

5 Responses to “How To Test For a Trend”


  1. 1 Steve Jul 28th, 2007 at 9:04 pm

    I wish I better understood how to set this up. Looks like a great tool

  2. 2 Isreli speculant Jul 29th, 2007 at 11:46 am

    If it seems complicated than I didn’t do a good job..What part you found difficult?

  3. 3 http://idisk.mac.com/fmp3musicdownloads/Public/free-legal-music-downloads.html Dec 11th, 2007 at 12:41 am

    Great boysfeddadbf7f73ff75329a759f3fd06b26

  4. 4 Tim Kennedy Dec 27th, 2007 at 3:17 pm

    Here you go pointing people at a normal distributions again… (just kidding, I see where you write about usually getting fat tailed distributions).

    What would be really cool is a way to get intraday prices to stream into your model and to be a ble to tinker with the distribution type.

    Great blog. I am always happy I visited. I keep telling myself I need to buy this guy a beer… maybe next time :)

    TimK

  1. 1 Option Trading - Israeli Speculator The Variance Ratio Method - a Powerful Trend Indicator at Pingback on May 30th, 2007 at 6:22 am

Leave a Reply