Thursday, June 19, 2008

How to make sure you’re in a trend?

My system tries to identify whether the market is currently in a trend. For the human eye discovering whether the market or a specific stock is in a trend is relatively easy. Just look at the graph and if the line goes up or down then chances are it is in a trend.

Discovering whether the stock is in trend helps filter the signals generated when the trend is opposite to your system’s trend. I.e if I build a system which trade only bullish market, I need to disregard all trades generated when the stock was in a bearish move.

When building a computerized system things become a bit complicated and my way of overcoming this problem was to measure the values of two close prices, one for the current day and one in the past x days. If the current’s day closing price was higher than the closing price of the other closing price I assumed I’m in a bullish period.

Running a test for this rule did eliminate lots of false trades however, I encountered another problem. There were times when the closing price of the current day was higher than the closing price of the previous measured period but only due to a peak in the price. Meaning, the stock was in the opposite trend but the system used two prices which gave resulted in a false signal. The way I overcome this problem was to measure the two periods on a moving average of the closing price rather on the price itself.


That did the trick. obviously you would need to find the right period for the moving average since using small period will make the moving average act like the closing price series and large period might be too slow and the system can miss the trend or enter too late.


If you have any other questions about computerized system, please let me know.

No comments: