An easy way to find breakouts

by Mar 25, 2022All Articles, Technical Analysis, Education

NOTE: This article first appeared in 2020 but has been updated to reflect subsequent changes that have been made in the PIVOT() function to account for unconfirmed pivots. As such, if you have existing scans or formulas from the previous article they should be amended, as per the examples below.

This version also includes sample workbooks that clients can download and open in their copy of Optuma.

As you may know, Optuma has several tools to help identify significant turning points, such as the various swing overlays, but one tool I’ve started to use more and more is the Pivot Label tool.

You can read more about the tool here, but basically it labels high and low turns based on the number of bars either side, so the higher the number the more significant the turn. In the example for the S&P500 below, the Pivot Labels on the left have been set to 10, which means that there must be at least 10 bars both before and after the high/low for a label to appear (in this case I used daily bars, but they work the same in any timeframe). Compare that to the 20 bar pivot on the right which will obviously show fewer – but more significant – turns as the interval required either side is higher.

Note: you can change the chart (or scan) timeframe to weekly to make the turns more significant.

This article will show you how to create a scan to identify breakouts from previous pivot levels and save those results as a watchlist in a workbook, so that every time the workbook is opened the scan will be automatically executed and the list updated – a great timesaver!

 

Creating the scan using the Pivot Labels tool

If we know the last pivot value then we can create a scan to alert us when that level has been breached, thus signifying a potential breakout that might be a great trading opportunity. In the scripting language we can use the PIVOT() function to calculate these levels.

In the script editor window add the PIVOT() function and click on the text to select your parameters, eg 15 bar pivots based on highs. 

NOTE: You should also ensure that the Ignore Unconfirmed option is ticked to prevent the results changing as new data is added to the chart.

This script on its own will simply return true when the current bar is the highest bar for at least 15 bars. To get the actual value at that point, we need to use the VALUEWHEN() function, ie the value when the pivot condition was true. By default the VALUEWHEN() function calculates the closing price of the trigger day, so we’ll need to nest HIGH() in the parentheses to get the high price on the day of the confirmed pivot. The complete formula will be as follows (remember the lines beginning  // are comments):

In this example of $AAPL, the last 15 bar high pivot was at $176.65, as shown in the watchlist and plotted on the chart using the same formula above in a Show Plot tool.

So now we have the previous pivot value we can compare it to the current price, and set a true/false signal if that level has been taken out using CrossesAbove in the formula:

Here’s an example of an ASX300 scan showing 8 breakouts, including $JBH closing above February’s 26 bar high of $54.32 on strong volume:

The Days Since Pivot watchlist column formula tells you how long the pivot level has been in place using the TimeSinceSignal function (ie 26 days for $JBH, and 57 for $FFX):

The watchlist also has a % of 20D Avg Vol column to show the if there was strong volume associated with the breakout. In the case of $JBH the day’s volume was 50% higher than average, whereas $DXI had less than half.

Breaking below pivot lows

To scan for breaking support the concept is exactly the same but with slightly different syntax for a pivot low because the price action is going in the opposite direction, ie CrossesBelow:

 

Save time by opening scan results in a Watchlist or Page Layout

A great timesaver is to open scan results as a watchlist or previously saved Page Layout, and then saving that in a workbook. From the Scan Results window click Export Results > Open Results As:

Because the watchlist is linked to the scan, when you open the workbook tomorrow (once the end-of-day data has been downloaded) the list will automatically update with the new breakouts.

This means you can have a workbook containing a series of page tabs linked to scans, so as you click on the tab the stocks with a true result will populate the watchlist.

 

Sample Workbooks

Optuma clients with access to Australian or US data can click the buttons below to save and open weekly watchlists showing 10 bar breakouts in true/false columns.

 

Automated scans and outputs

Enterprise Services clients can set up command line prompts in the Windows Task Scheduler, which will automatically run the scans at a time of your choosing. The results will be automatically exported as either images, a PDF, a .csv list of symbols, or even an email (Microsoft Outlook clients only) using your preferred page layouts. You can watch a video on building command lines here.

 

Need more help?

If you have any questions or need more help with creating custom scans or formulas please post on the scripting forum. Make sure you search the forum first to see if your question has already been answered, but if you need more advanced help then one-on-one consulting sessions are also available.

Share Link
Darren Hawkins, MSTA

Darren Hawkins, MSTA

Senior Software Specialist at Optuma

Darren is the senior Software Specialist at Optuma. He joined the company in 2009 after attending an introductory technical analysis course. Darren now instructs users all over the world, from experienced Wall Street traders and professional money managers to individual traders drawing their first trendlines.

Darren grew up in the UK and attended college in the USA where he earned a BA in Economics from St Mary's College of Maryland. He went on to spend a few years working at the Nasdaq Stock Market in Washington DC. Going on to live and work in Australia, the US and currently the UK, Darren has a broad understanding of the individual needs of traders, portfolio managers and investors utilising a wide range of methodologies.

In 2014 Darren passed the UK-based Society of Technical Analysts diploma course, and when not looking at charts he keeps a keen eye on England's cricket team - especially if they are playing against Australia. He lives in the Essex countryside in England, with wife Wendy and their labrador, Gabba.

2 Comments

  1. Michael Robinson

    Darren, great work, might be an idea to create a pivot tool with your code in Optuma.

    Only when you have time which would be rare.

    I realise that there are already 3 pivot tools in Optuma but this would be a great and very useful 4 th one.

    Cheers Mike (Australia)

    Reply

Submit a Comment

Your email address will not be published.

Blog Signup

Pin It on Pinterest

Share This