Expansion & Contraction


Since last post I created a new algorithm for our project which focuses on the concepts of expansion and contraction of stock prices. The market alternating between expansion and contraction is one of the principles that our project sponsor tasked us with researching and detecting in the form of an algorithm.

I had the most success using two simple moving average lengths (6 and 18 days) and calculated the range for each SMA by subtracting the SMA low from the SMA high. My reasoning for using one shorter and one longer SMA was to attempt to compare them to determine when expansion and contraction were occurring. My logic was that if the shorter SMA range is greater than the longer SMA range, this would indicate that a range expansion is occurring (since the shorter SMA range takes more recent price data into account), and if the shorter SMA range is less than the longer SMA range, this would indicate that a range contraction is occurring.

According to my research, range expansion indicates that trend continuation is likely to occur, and range contraction indicates that trend reversal is likely to occur. With this in mind, when my algorithm detects a range expansion, it also compares the shorter SMA close price to the longer SMA close price to determine if the price has been recently trending upwards or downwards. If the price has been trending downwards and a range contraction is occurring, this indicates that a trend reversal (of a bearish trend) is occurring, and so a buy order is issued. There is one other buy order and two sell orders that use this logic of the different combinations of range expansion and contraction with recent price movements.

So far, the algorithm has performed very well and I look forward to continuing to improve upon it.

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *