In this issue I will present the outlines for a new Bottom Spotter system. While the pundits of the Efficient Market Hypothesis claim that the market has no memory and there is no way past market behavior can affect future prices, this program convincingly demonstrates that this is not the case. Being able to spot bottoms is obviously very useful. It can either offer potential points of entry for long positions, or warn of trouble if the investor is presently short the market. As with anything which relates to stock market prediction, it is certainly not infallible, but back testing has shown that it is much better than chance. In fact I will also present the outlines of a trading strategy which seems to be reasonably effective on many stocks, especially if the prevailing tendency of the market is upward.
The code listing on page 2 shows the Bottom Spotter function. The function can be used in two ways: First as a “Show Me” which displays a dot on the chart if the criteria are met for a potential bottom. Second it can be used as an element in a broader strategy to locate appropriate buy points. It is written in TradeStationʼs EasyLanguage code which is fairly intuitive and easy to read. This can easily be translated to other platforms and languages.
The first thing we see in the code listing is the inputs section. These are the parameters taken in by the function. This allows the calling program to alter certain aspects of the function values for preference and optimization. The most commonly altered parameter is probably the last one which specifies the Threshold at which the function will decide whether or not to declare the given bar a bottom bar. Next the variables used for the program are declared. Most of them are set to zero with the exception of eSampleNum which is set to 50.
The heart of the program begins with the line:
StDevOC = StdDev(Open[BarsBack]- Close[BarsBack], OpenCloseLB);
This simply computes the standard deviation of the difference between the Open and Close for the lookback period. The length of the lookback is specified by OpenCloseLB and is passed to the function by the calling program. This is an important number because it allows us to get a baseline of what is a typical Open/Close differential for the given number of previous bars. The next line computes the average Open and close differential for the most recent period (say the last six bars) and assigns the value to the variable Tester. Next the function checks to see if this value is greater than zero, and also checks to make sure the StDevOC value is greater than zero. In fact the latter check is really just to make sure there is no division by zero error generated by the program. The first check is substantive, however, because if the value is greater than zero it means the bars are showing opens lower than closes on average for the last six bars. The assumption is that bottoms are more likely to occur after a series of red candles, or where opens are higher than closes.
By dividing by the standard deviation for the last 50 or so bars it allows us to put the move into perspective. For one stock, a differential of 2 points might be extreme, while for another this might represent a relatively calm day. The standard deviation gives us a baseline for comparison. Finally we assign the result of this division to the Stridency variable after multiplying by a compensation factor to raise the significance of the score. This will be combined with other elements to produce the Subscore.
Next we look for the consistency of the recent move. Here we are not concerned with how far the market has moved over the given period, but simply how consistent that move has been. Bottoms are often preceded by very consistent declines. The line “For Ctr = 1 to ConsistencyBarNum” sets up a loop using the Ctr variable to check through the last number of bars specified by ConsistencyBarNum. If the Close is less than the open, then 0.67 is added for each iteration of the loop. So, to cite the positive extreme, if all of the recent closes have been below the opens then this will yield the maximum score. On the other hand, if all of the closes were either above or equal to the opens then the score will be zero.