# Volume Based Indicator Analysis Part 2

As I mentioned in my earlier post, there were several places where I could have taken one of a number of directions, but I chose just one and moved on. In this post I’m going to go over some of the other experiments I’ve performed since then.
Recall that I used a weighting factor, where the most recent date received a maximum weight (15), and the weight for each date prior to that was decremented by one per day. This choice of weights was arbitrary, so in this post I’m going to discuss the effect of choosing these weights differently.
The alternative weight schemes I’m going to cover are:

1. Multiplying each weight by a constant for earlier dates
2. Choosing a date other than the most recent one to have the maximum weight
3. Use a constant weight for the most recent N dates, then multiply the weight by a factor for earlier dates
4. Use a constant weight for the most recent N dates, and don’t use any earlier dates

I actually tested quite a few more, but so far these have the best results so I’ll only go over them.

This was the result of the original experiment that we’re trying to beat:

For the first experiment, the best result came from multiplying the weighting factor by 0.85 each day. So the most recent date was weighted 15, one day prior was 12.75, two days prior was 10.8375, etc. Here’s a graph of the results:

We’ll compare this directly to the earlier results later, but if you’re thinking it’s not much different, you’re right. There’s a slightly higher peak, but for the most part the results are very similar.
Moving on to the second experiment, choosing a date other than the most recent, it turns out that slightly better results are obtained by giving the largest weight to two days ago, rather than the most recent date:

For the third experiment, we’ll use the same maximum weight for the most recent three days, then apply a multiplication factor of 0.7 for each day prior to that:

Finally, for the fourth experiment, we’ll weight the four most recent days equally, and assign a zero weight to all days prior to that:

And now for the denouement, we’ll look at all five of them together:

The most surprising thing to me about the above graph is how consistent it is. I spent a lot of time tweaking each of these and kept just the one that did the best. And they each have pretty much the same distribution.
I’ll probably spend time looking for other ways to tweak this to see if I can find significantly better results, but it’s possible this is all the stock prediction information content there is in the combination of trading volume multiplied by percentage change.

# Volume Based Indicator Analysis

In this post I’ll share part of an analysis I’m doing on a volume based indicator.

I wanted to examine the correlation between a stock’s volume and its price movement.  From published research (e.g. this paper) I knew there should be a relationship.  Before using it in a model though I do my own analysis to understand not only what the relationship is, but also how reliably it holds up over time.

There are many ways to construct a volume based indicator, for this post I’m only going to cover one.

For a given stock, the indicator is based on the past 15 days’ worth of trading data.  For each day, the stock’s trading volume is multiplied by the percentage change in its closing price from the previous day.  E.g., if 10,000 shares of the stock was traded on a given day, and it’s price went down 1% that day, the contribution from that day would be 10,000 * -0.01 = -100.  If 10,000 shares of the stock were traded on a given day, and it went up 0.5% that day, the contribution from that day would be 10,000 * 0.005 = 50.  This value is calculated for each of the past 15 trading days.

We now have 15 values for the stock.  Each value is multiplied by a weighting factor.  The weighting factor is 15 for the prior day’s value, 14 for two days prior, etc.  The weighting factor for 15 days prior is simply 1.  We then take all of the weighted values that are positive (i.e., values from days the stock went up) and sum them together.  We do the same for all of the values that are negative (i.e., values from days the stock went down).

We’re down to two values, a positive value (from days the stock closed up) and a negative value (from days the stock closed down).  Either value could also be zero, of course, if the stock went up or down all 15 days.  The indicator for this stock on this particular day is the sum of these two values divided by the difference between these two values:

indicator = (positive value + negative value) / (positive value – negative value)

Don’t forget that the ‘negative value’ is, indeed, negative, so the above equation corresponds to the difference between two numbers divided by the sum of the same two numbers.  Thus, the indicator as constructed will always have a value between -1 (if the stock went down all 15 days) and +1 (if the stock went up all 15 days).

There are multiple ways to use an indicator, for this post I’ll examine how it’s related to the relative change in stock price over the next 5 trading days.

I chose 29 dow stocks for this analysis, for the years 2005 – 2015.  To be precise, I used the stocks that were members of the Dow Jones Industrial Average at the beginning of 2016, excluding Visa (which wasn’t publicly traded for the entire time frame).

We want to see if high or low values of the indicator, relative to the other stocks, are correlated with outperforming those other stocks over the next five trading days.

For each day over the study period, we rank the 29 stocks according to their indicator values (0 through 28, with 0 being the stock with the highest indicator value).  We then find the three stocks that had the best performance over the following five days.  We look up the indicator rank of those three stocks, and increment counters corresponding to their ranks.  For example, if the three stocks that did the best over the next five days have ranks 0, 26, and 28, we increment counters corresponding to ranks 0, 26, and 28.  There are a total of 29 counters, one for each rank position.

The above process is repeated for every day over the eleven year period.  A graph of the results is below:

The correlation between volume indicator rank and stock price change over the following five days certainly doesn’t look strong from this graph. It appears to be random numbers centered on 275.  In fact, if the samples were evenly distributed each rank would have occurred 286 times.

If you look carefully, though, you’ll see that ranks 24 through 28 are all above 300 occurrences.  It turns out that, over this study period, stocks that had one of the five lowest indicator ranks were 14% more likely to be among the best three performers over the following five trading days.  I.e., more down volume is somewhat correlated with a greater likelihood of the stock outperforming over the following week.

That isn’t a very strong indicator.  There are better indicators out there, and it’s possible that with different parameters there’s a volume based indicator better than this one, too.  There’s a good enough correlation with this indicator though that it’s worth investigating further.

An important question is whether or not this is a reliable indicator.  I won’t put the details here, but it turns out that over the study period this indicator was correlated to stock price change about 50% of the years.  I.e., in five of the years this volume indicator was correlated to a rise in the stock price over the next five trading days (2005, 2007, 2008, 2009, 2013), and in the other six years it was not.  Again, that isn’t great, but with some research it may be possible to find a better version of this indicator.  It’s interesting to note that it was not correlated to outperformance in most of the bull market years after the 2008 crash.

There were a lot of places in this post where I said I would include results from just one of many possible ways to analyze volume / stock price change correlation.  In future posts I’ll analyze variations of the volume indicator presented here.

# Model A Indicator Output Meanings

A couple of people have asked me what the Model A outputs (‘Positive’ and ‘Negative’), mean.

A ‘Positive’ output means that in the past, under similar conditions, there was a greater than average chance that the market would be higher in 4 weeks than it was when the output was made.

A ‘Negative’ output means that in the past, under similar conditions, the model did not provide any statistically useful information about market direction over the next 4 weeks.