So, you have your stock prices adjusted for corporate actions like splits and dividends. How do you use this information to perform trading? When you buy, when you sell, or even which stocks do you buy or sell. You can take these decisions based on signals that can be derived from historical price data. The first step in this process is to compute statistical measures that are called indicators. You can think of the raw price of a stock as the most basic kind of indicator. Here are the stock prices for Facebook over a one-year period. The latest price is about $115. Is that good? Should we buy some Facebook shares? Well, it’s not clear. The price seems to be jumping around a lot and we don’t have a sense of where we should expect to be. If we had that, then we could check if their current price is significantly higher or lower than the expected price and make a decision based on that. So, what is the expected price of a stock? Is it the average price from when it began trading? That seems a little too extreme. Stocks can grow in orders of magnitude over the years. Most current prices will be well over the average. What might be relevant is the recent average price of the stock. Maybe over the past week or month, we can extend this idea throughout the history of the stock and compute the average of a fixed length window of time. It’s like moving the window one unit at a time and taking the average price within that window. This is known as the simple moving average or rolling mean. We could devise a trading strategy that looks for large deviations from the moving average, and generate trading signals based on that. For instance, if a stock falls too far below its average, then we should buy it, or if it rises too far above, then we should sell. But, how much is too much. Using a constant number or a threshold does not seem like a good idea. Different stocks trade at different price levels. We need a measure that is tied to the price of the stock, maybe some fraction of the stock price. But again, what fraction? We don’t know. Some stocks jump around a lot. Some are more stable. A better idea might be to compute the threshold from the jumpiness or volatility of the stock. How about standard deviation? In fact, we can reuse the windowing idea and compute standard deviation over the same fixed length window across time. These lines are called Bollinger bands. All these peaks sticking above the upper band are signaling that the stock is trading at a higher price than normal. The dips below the lower band are signaling abnormally low price. One problem that you might notice is that there’s too many such points. We can reduce them by increasing the width of the bands. That is, by considering a wider range of variation to be normal. A common threshold is to choose two standard deviations above and below. Now, we have far fewer outliers. But the question remains what do we do with these outlying points? Sometimes we get short burst of outliers. So, should we buy or sell each of these points? If you think about it, when the price falls below the lower band, you don’t really know if it’s going to keep falling or is it going to rise back up. Maybe it’s wiser to focus on these inflection points. When the price is below the lower band and starts to cross back inside towards the mean, that should be a good time to buy. The price is still fairly low and on a rise. On the other side, we can sell when the price crosses down the upper band to the inside. This gives us a series of buy and sell signals. At this point, you must be wondering, how much money would I make from following these signals. Well, that opens up a whole can of worms. We’ll have to decide how much money you invest to account for the brokerage charges and for a few other things. Let’s just kick this can down the road and we will look at again when we talk about backtesting. For now, think about the indicators we just computed. Simple moving average and standard deviation and the trading signals we derived from them. This was a fairly simple approach. See if you can compute other indicators and better signals from the price and volume data.