Monday, September 30, 2019

Finally Bollinger Bands #1


Finally, the long wait is over. Since my last post (3 weeks ago), I’ve been doing some work on the Bollinger Band analysis I promised. It has taken way too long. There are 2 reasons for this. First, I’m still in the nursing home. There are far too many interruptions during the day to get any time to work on the project. At night I mostly sleep but have been able to squeeze in a few early morning hours to work on the simulation program. Second, the program turned out to be more complicated than I anticipated. That coupled with sporadic work periods led to a frustrating development cycle. But finally, I’m at the point where I’m beginning to generate results that I can study. Now on to Bollinger Bands.

Bollinger Bands is a technical analysis tool used to set buy and sell price points for a given stock on the financial markets. We are going to apply the formulas to bitcoin prices (BTC). The calculation has 2 components. The first is the simple moving average (SMA) over the period of time being considered. The second is the standard deviation of these prices over the period. We’ll start with the normal defaults (20 days and 2 standard deviations).

The simulation program looks at data for a specific day. It uses the closing BTC price for the previous 20 days. It computes the SMA and standard deviation for this data. It then sets an upper and lower price range. The upper price limit (sell signal) is the SMA plus 2 standard deviations. The lower limit (buy signal) is the SMA minus 2 standard deviations. The program then sets buy and sell limits. It looks at the high and low price for the day in question to determine if a trade would have occurred.  If no trade would have been made, then the limit orders are reset for the following day.

When the simulation is run for each day in 2018, trades would have been made on 99 days (67 buys and 32 sells). The 2019 data through the end of August found trades on 80 days (16 buys and 64 sells). While the number of trades is interesting, the real interest lies in the profitability (or loss) of these trades. There are lots of other interesting questions or options. We’ll start addressing these in my next post. Hopefully the posts will happen more frequently. Follow @billlanke on Twitter to know when these occur.

No comments:

Post a Comment