May 29th, 2024

How to Find Setups Easily and Quickly

An overview of our chart similarity filter

Shan (e0) is base.report’s founder and developer. Previously, I talked to him about the software in general – who should use it and why, and how to get the most out of base.report.

One of the topics that cropped up was base.report’s chart similarity filter. This makes a very useful study companion, as well as a huge time saver for doing your pre- or post-market homework.

Today, Shan is treating us to a full overview of this feature, including some ‘behind the scenes’ information about the inspiration behind it, how he got the feature to work from a technical point of view, and more.


In this interview

  • What the chart similarity filter is
  • How the similarity filter works
  • Use cases for this function
  • The inspiration behind it
  • Improvement plans

What is base.report’s chart similarity filter?

As the name suggests, it lets you find charts similar to an ‘archetype’ – a chart pattern you have in mind, usually reflecting your ideal setup. This archetype needs to be a real-life example – so a specific stock from a specific time.

SNDL similar charts

How does this feature work?

Like most software functions, we’ve got an input and an output.

In this case, the input is a segment of a stock chart. [It can also be an ETF or a fund. The default is the most recent 100 trading days.]

The output is a list of stocks, ranked by chart similarity.

More specifically, we’re comparing the closing prices of the input with the closing prices of every other ticker in our database.

This video, presented by Whos_Agent, shows you what this feature looks like and how it works:

You say you’re just comparing the closing prices. But clearly the function doesn’t just look at same-priced stocks. Could you explain that further?

This goes back to how I got the feature to work from a technical point of view.

When building the feature, I first tested chart ‘images’ to each other, using OHLC charts, but found that it took way too long for the scanner to return the results. [On the bright side, the results did seem correct.]

I then simplified the images – so the information being compared – by using line charts rather than OHLC charts. This didn’t sufficiently reduce the comparison time, but I was pleasantly surprised that the results appeared just as good as with the more detailed information.

It then hit me. If comparing line charts gets good results, why don’t I just compare the numerical values instead?

And as it turned out, after normalising the closing prices and using MSEs [mean squared errors], the comparison time went from about one minute to about one second.

That ‘normalising the numbers’ point is key. It’s a bit like stacking two strings [line charts] on top of each other and checking how much they overlap. This allows the system to identify which charts are most similar to the input.

Thanks for that background – very interesting! So, coming back to the user perspective, how should traders use this function?

There are two main use cases:

  1. Ranking screener results based on how similar they are to your ideal technical setup.
  2. Looking for stocks that are potentially in the same theme but not industry.

To elaborate on the first use case, for traders, finding a good setup is important to be able to manage risk – it allows you to get a good entry point.

In terms of how you’d actually use the filter in this way, a visual example probably illustrates this best.

Suppose you’re looking for breakout setups. That means you’re looking for a recent surge in price, followed by consolidation.

You’d first apply basic liquidity [20-day average dollar volume] and volatility [20-day ADR – average daily range] filters. Then, you add a similarity filter.

Here’s an example – a specific portion of $AMC in 2021 that represents an ideal breakout setup. Put in the desired end date, then type in your look-back period.

AMC breakout setup

[In this example, the end date was set to 2021-06-30, and the look-back period was set to 36 trading sessions. The 20-day average dollar volume was set to a minimum of 10 million, and the 20-day ADR was set to a minimum of 3.]

Hit ‘Confirm’, then you’ll get the following top results:

AMC breakout setup results

Although not as explosive as the input chart, these stocks have all made an upward move lately and are currently surfing the 10- and 20-day moving averages.

Can you elaborate on the second use case too, please?

An important part of situational awareness is identifying the best-performing themes. A theme, however, is often not as simple as collecting all stocks listed under one industry.

For example, $SNDL and $CGC are both cannabis stocks, but they’re listed under different industries: “Beverages – Wineries & Distilleries” and “Drug Manufacturers – Specialty & Generic” respectively.

SNDL similar charts

Another potential problem is that some industries contain a lot of stocks. Almost 300 stocks fall into “Software – Application”, for example.

With that in mind, the chart filter can save a ton of time in identifying groups of stocks that move together, while improving the completeness of your themed watchlists.

Because you’re looking for stocks that move together, you’re also looking for similar chart patterns – what’s gone up a lot lately? What’s basing nicely? Chances are this’ll help you catch stocks – potentially part of the same theme – you’d have otherwise missed.

Equally, you’d probably feel overwhelmed at looking at 300 charts, just to catch the handful that might be setting up. Again, the chart filter will help you narrow it down to the tradeable names.

What was the inspiration behind this filter?

When scanning for stocks, I’ve always found it a bit tedious to have to look through hundreds of results to find the handful of stocks I might be interested in.

As mentioned previously, even if I’d get less good results [due to more limited situational awareness] by looking at fewer charts a night, but these are the right charts, I’d be very happy with that outcome.

So, I tried to channel some of my more negative traits – such as laziness* and impatience – into positives. More specifically, into potential solutions. How can I automate tedious parts of a process?

Inspired by other tools, like the ‘Candlestick’ filter on finviz, I decided on building a function like this. Or at least, as soon as I’d confirmed for myself that technical chart patterns are, in fact, meaningful.

*Interviewer note: I think Shan is being hard on himself here. After all, he built base.report!

Could you elaborate on that?

So, we hear a lot about these technical setups, which make theoretical sense. But I wanted to confirm for myself whether they actually matter.

So, I did a study to answer this question. The key steps were:

  1. Collecting breakout setups programmatically. [You can read more about the process in this previous study.]
  2. Using machine learning image clustering techniques [a way for a computer to automatically group similar-looking images based on their visual characteristics] to group the setups based on chart similarity.
  3. Analysing the data, trying to answer:
    1. Do specific groups of setups perform better than others?
    2. What do the ‘average images’ of individual groups look like?

I found the ‘average image’ of the best-performing groups to closely resemble stocks entering stage 2 uptrends and consolidating after their first ‘leg’ up.

A technical setup isn’t everything. But the data gave me conviction that chart patterns matter. Which encouraged and excited me to build the chart similarity feature.

How do you plan to improve this feature in future?

At the moment, I’ve got three ideas I’d love to explore:

1. Better UX [user experience] for selecting chart segments.

Currently, we use date pickers for the start and end dates. But draggable handles on the chart might be a more convenient and user-friendly alternative.

This is something that requires some experimenting to see if it’s something we want to adopt.

2. Looking into volume.

We currently only compare the closing prices. But one of our users from the Discord server mentioned that also looking at volume might improve the search results.

I think that’s a really good theory, which I’ll be looking into. If the results are indeed better, and performance doesn’t significantly suffer, we’ll try to incorporate this in future.

3. Drawing a curve as an input.

Again, the input to this function is just a list of closing prices. So, there’s no technical reason we couldn’t use an arbitrary list of numbers instead.

It’d mean you could literally just draw a cup and handle pattern, or whatever, instead of having to dig up a historic example. And I already have a rough idea of how to implement this without affecting performance, so you’ll very likely be seeing this option in base.report in due course.


Try base.report for free

Are you ready to give base.report a go? You can use our screener, including our chart similarity filter, right away here – no strings attached.

If you also want to start building watchlists and saving scans, sign up for free here. You’ll get full access to all features for 30 days. We won’t ask for a credit card, so your trial won’t auto-renew.


Give us your feedback!

We’re always looking to improve base.report. Many enhancements are a direct result of user feedback. And we incorporate most feedback within weeks, if not days!

Please email us at [email protected] or join us on Discord. Whether you want to share feedback or have a question, we’re always happy to help!