Blog

Coming from the world of physics, I always led with the assumption that one could find patterns in places where chaos seemed to reign supreme. It's no secret that the financial industry, specifically the portion of that industry tied to the stock market, is filled with brilliant individuals attempting to accomplish that very task. I always wondered whether a layperson could compete with professionals in such a space.

*Can simply anyone build an analysis system, capable of identifying trading signals on the stock market?**Do you need vast computational power to run such analyses?**Is expert algorithmic knowledge required to gain an edge, only accessible to coding wizards?*

The answer to such questions, in my opinion, is **both yes and no**.

**Yes**, because starting in roughly the 1970s, an entire academic field was born: mathematical finance. When someone dedicates their entire academic and professional lives to one topic, they're likely going to carry an edge. Add on machine-learning applications taking advantage of all kinds of computational power and, yes, it's going to be difficult for a layperson to compete.

**No**, because in today's modern world, data is more accessible than ever. Knowledge is freely available to those who want to find it. Ideas in such a space, once considered untouchable secrets, are becoming shared more frequently. The roadblock, it seemed, was whether or not one knew how to code.

My goal below is to prove that, yes, it is possible to build a code-free trading analysis system and that, no, you don't need a super-computer or a computer science degree to do so.

Before we dive in, let's define what type of strategy we'll be attempting to analyze.

If you're like me, you probably don't want to introduce a ton of risk to your portfolio. At some excess level of risky behavior, trading stocks can seem more like playing Blackjack. To avoid that, many invest in a passive fund like the SPY index, which tracks the SP500. It is often argued that if a trading strategy does not outperform the SP500 in terms of both overall return and risk, it is not a trading strategy worth implementing.

For that reason, we'll explore two strategies below and compare them both with the SPY index as a measure of efficacy.

Let's first *loosely* follow in The Oracle of Omaha's footsteps, otherwise known as Warren Buffett. Buffett is well known for analyzing companies' fundamentals and placing long-term bets on those with promising financials. Our first strategy will aim to take the entire SP500 and filter out those companies with poor fundamentals, leaving us with a small group of supposed winners.

Bollinger Bands is the name of a strategy effectively banking on the phrase: "what comes up, must go down"; or vice-versa! It's a statistical strategy that finds the moving average of a given stock and produces a signal when the actual price gets too far out of whack with that average. The argument: If a given stock rises too much too quickly, it is likely going to fall back to Earth to at least some extent. If we can take action on such signals over time, what will the outcome be?

First, the fundamentals approach. Which fundamentals will we be focusing on and how will we filter with regard to them?

- PE Ratio (Price to Earnings)
- Total Debt to Asset Ratio
- Current Asset to Debt Ratio

We're going to divide the SP500 up into sectors such as Information, Manufacturing, Retail Trade, etc. For each sector, we will calculate the average PE Ratio, Total Debt to Asset Ratio, and Current Asset to Debt Ratio.

Using those averages, we will filter sectors by the following rules:

- PE Ratio - Only accept sectors with average PE Ratios greater than 0 and less than 20.
- Total Debt to Asset Ratio - Filter out sectors above the 97.5th percentile. In other words, let's get rid of sectors with an abundance of debt.
- Current Asset to Debt Ratio - Filter out sectors below the 2.5th percentile. Another way to put it, throw out the sectors with very little assets currently on their books.

If a sector meets all three of these conditions, it survives!

Let's take a look at the remaining sectors and their values for these ratios.

Looks pretty good to me! Better yet, the entire analysis thus far was enabled by the chunk of the Cascade workflow displayed below.

At this point, we're left with a group of companies making up the remaining sectors. Applying those same filters to the remaining individual companies allows for even more thorough filtering to take place.

Take a look:

Is it ironic that the Oracle's company (BRK-B) survived our filter? Probably not.

When averaging these companies' fundamentals, here's what we get:

Let's get to the fun part. How did our surviving companies do during the time period of our analysis? (January 2021 - May 2021) Our surviving companies will hereafter be called the "Basket" while our comparison benchmark is the SPY index.

Not bad! The basket returned roughly 13.7% while the SPY index return about 9.4%. What about risk? We'll measure risk here with a simple metric known as the Sharpe Ratio. Generally speaking, the higher, the better.

The SPY index has us beat here. The question becomes: are we okay with accepting extra risk for an excess return of around 4%? While it shows promise, for the sake of argument, let's call this a failure and move on to our next strategy.

Remember, Bollinger Bands are built off the principle of mean reversion or, put simply, the idea that any statistical measure will likely revert to its usual state. Let's check this out as applied to stocks, given an example company, 3M Science (MMM).

The strategy is pretty simple, we believe that the price is going to stay in between the two bands. How are these bands calculated? Cascade allows for the calculation of these bands by way of first calculating a moving average of the price. All that means is that we'll take the last, say, 5 days of data and calculate the average price. We'll also use the last 5 days of data to calculate the standard deviation of price. Adding and subtracting this standard deviation to our moving average forms our bands.

This is really where the statistical essence of the strategy comes into play: if our price moves an entire standard deviation above where it's been lately, we believe it's going to come down, and vice-versa. Check out the chart above! The proof is in the pudding.

Thanks to Cascade, we can easily reproduce this analysis for whatever period of time we want to evaluate; ie ~ let's create this average and standard deviation pair from 10 days of data instead of 5. We can also alter how many standard deviations up and down we place our bands. Do we want to allow shorting in our strategy, alongside simple buying and selling? There's an option for that, too. Check it out:

The beauty of Cascade: upon altering any of these global variables, your analysis will instantly re-run, allowing for quick and easy comparison to take place ... something usually reserved for code!

Finally, let's check out the results of this Bollinger Band strategy and see if it is worth all the praise I've given it. The following represents the cumulative return when applying the Bollinger Band strategy to the group of filtered stocks described above.

In terms of return, we're looking pretty good at roughly 26% when all is said and done.

What about that risk?

Knocked it out of the park! The Sharpe Ratio here is more than double that of simply buying and holding the SPY index. We were able to nearly triple our return while also more than doubling our risk metric.

The quantitative finance stuff is pretty exciting to me! It turns out that no algorithm expert was needed! The best part, however, is that this was all accomplished within the confines of Cascade. In one big, beautiful workflow, we analyzed both fundamentals and technical dynamics of the entire SP500. Perhaps not quite The Oracle of Omaha, but pretty good if you ask me.

Stay up to date on advances in analytics, no-code workflows and Cascade product launches.

Oops! Something went wrong while submitting the form.