One of the simplest and most used indicators in all aspects of trading, is the moving average. The Simple Moving Average (SMA) usually takes the average of the closing price over that last number of defined days. For example, in the chart below, a 9 day SMA is used.
A signal is generated whenever the price of the stock crosses above or below the SMA line. (Indicated by the arrows). A buy or bullish signal is when the stock is above the average and bearish when below. As you can see however, with a short timeframe, such as 9 days, there are times, particularly in a flat market, when signals may be generated way too frequently and causing losses. An obvious way to reduce those instances, would be to use a longer term average, like 20 days.
As we can see, fewer signals are generated, however, due to the longer time interval, entries and exits are often after the trend has turned around already. One way to have the average move more in time with more recent pricing changes, is to use the Exponential Moving Average (EMA). This average gives more weight to recent prices then it does those at the end of the range. In other words, yesterday’s price is more important in the average than the one 20 days ago.
One common improvement on the single moving average line, is to combine two lines of differing ranges, one short term and one long term. For instance, in the chart below, we see a 9 day and 20 day EMA chart.
When using a 2 line, 2 range chart, signals occur when the faster line (9 day) crosses above or below the slower line (20 day). A bullish signal is when the slow crosses above the fast and bearish is the reverse. Again, you can see a reduction in signal activity and in improvement in the timings.
Common signal timeframes are 9, 21 (or 20), 50, 100, 200 (or 250). There are no right or wrong timeframes, nor the number of lines to use. 3 line moving averages are also common. It really is up to the individual to decide what values produce the outcome they are looking for. Different stocks move differently as well, so what works best for one, may not be the best settings for another.