Guest User | Sign In

Knowledge Base

Custom Market Breadth Module


The custom Market Breadth module gives the client the ability to create a measure based on any technical criteria that can be defined with a script formula. The only requirement is that the script must return a true/false response, or a calculation that can be measured e.g. is the close above the 12-period exponential moving average? Is the RSI(10) greater than 75? On average, how far away is each stock from its moving average? Each of these will return result for the selected universe (eg S&P500 companies, or your portfolio) and will show the result as either a percentage, a count, a sum or an average.

Note: The Market Breadth module is available with a Enterprise Services subscription or as an optional add-on module. For standard Breadth Measures data (including Advance-Decline Lines, % above 50MA, % within 20% of 52 week high) see here.

Blog posts:

Using Optuma’s Market Breadth Engine - Part 1

Using Optuma’s Market Breadth Engine - Part 2

What is Market Breadth?

The concept of Market Breadth requires an enormous amount of computational power basing calculations on objective data.

The best place to start is with the Advance Decline Oscillator. The value is simply achieved by taking all the members of the Index and comparing the members that are advancing versus the members that are declining. The reason this so important is that it has been found that at market tops, it is the heavyweights of the stock market that are getting the "late money" and due to their size they continue to take the Index higher. What is not so evident is that all the small caps are usually the first to change trend at a turning point in the market. Market Breadth aims to alert the analyst of these changes before it is evident in the trend of the Index.

As an example, in the Dow Jones Industrial 30, if 15 stocks are advancing and 15 stocks are declining our result for that day would be 0 (15-15). Below is a small table with some examples of how the numbers could work:


Both the Net Advance and the AD Line can be used as Breadth indicators. With the Net Advance, the result is more like an oscillator and it gives a chart like the following:

The final column in the table is the AD Line. This is sometimes more correctly called the Cumulative Advance Decline line where today's value is based on yesterday's value and the result of the net advances.


With the AD Line, the actual value has little reflection to the number of securities as the value can grow to be a very large positive or negative number. Rather, the analyst is looking at the plot and determining if there are divergences between the Index and the AD Line.

Step by Step

Market Breadth is accessed from the Data Menu in Optuma.

When the Market Breath form opens for the first time, a new Breadth code is created and a function is also added ready for setting the criteria. You could use one of the criteria in the drop down, or create your own by clicking on the FX in the tile.

In the script editor, we are going to make our condition that each equity is positive when its close is above the 200-day Weighted Moving Average.

Note: With these scripts, you need to set the name at the top.

Once you have entered the script, select Apply.

The next step is to choose the data set that we are going to test this on by going to the Breadth Properties and clicking on Codes to Include. What you use exactly is dependent on the data source you have. You can also use the Lists tab to select Symbol Lists which may be lists of codes from CSV files or the constituents of a Bloomberg Index. In this example, we are going to use the current members of the S&P 500 Index.

Next, we need to give the result a code and a name. The reason for this is that once the calculation is complete, the result is stored in a data file just like any other security. This means that you can overlay it on charts and even set alerts on it. A good suggestion is to use a combination of the data being used and the condition so that you can easily identify the various measures created. When the name is updated, the Breadth measure in the list is also renamed.

Other Settings

We've dealt with the 1st three breadth properties however we need to deal with the last as they are also very important.

Membership: Allows your breadth to use data that is free of Survivorship Bias. For more information on this, please click here.

Date Range: This defines how far back you will have Optuma create the calculations. Optuma will load all the data files for that range and then calculate how many passed the criteria. We must put a warning here, if you are using Index members as your universe, then you are selecting the equities that "survived" ie they are companies that did not go bust as the ones that did are no longer in the index. Worse from a bias point of view is that some of those equities may have been a penny stock. For this reason, we do not recommend going back further than 5 years (until we find a way of testing with the Index members that existed on that day).

Data Time Frame: This allows you to build a breadth code based on Daily / Weekly / Monthly or Yearly data. This can be used when the underlying data building the breadth is only updated in weekly, monthly or quarterly intervals.

Breadth Action: This defines the type of result displayed. The following are the possibilities:
  • Percent - What is the percentage of the members that have passed the test? We count the passes and divide by the total number of universe members.
  • Count - Simply the number of members that passed the test.
  • Sum - This one is a bit of a departure from traditional Breadth. With Sum, you can have a script that returns a value like RSI() or percent that the close is above a moving average and this function will sum together all those values. It is best that your script result is normalised else high-value stocks may overweight the result.
  • Average - Based on the Sum above, this one divides the result by the total number of members to get an average each day.
The following take into consideration the members that passed and also the members that failed.
  • Spread - This will take the difference between the codes that Passed and those that failed, so if 375 passed and 125 failed, the result will be 250.
  • Cumulative - This is one of the traditional measures of Market Breadth. In this one the Spread between the members passed and members failed is added to the result from yesterday.
  • Ratio - In this case, we take the number that passed and divide by the number that failed.
  • Geometric Average: This option is calculated by taking the product of the numbers generated by the script and raising it to the inverse of the length of the series.

Auto Update: Selecting this option means that when Optuma is started in the morning, or when new data is received by the end of day data feed, Optuma will automatically run the calculations for the latest day and add that value to the file to keep it up to date. This can be slow if the calculations are intense or data needs to be sourced from a 3rd party that is slow.

The Data menu contains a new option called "Update All Breadth Indicators". When Auto-Update is unticked, you can use this action to rebuild all of your breadth codes at once, rather than one at a time.

Decimal Type: Sets the decimal place setting to be used, e.g. 0.00, 0.0000, halves, 32nds.

Generating the Breadth Chart

Finally, we need to run the Breadth Calculations by pressing the Build Breadth button. If all the data is present, this will build five years of data in a few seconds and the time will be listed as well as a chart showing you the result.

From here you can double-click on the chart to open it as a new chart in Optuma, or you can press F3 and look in the Market Breadth folder.

Once the chart is open you can see the performance.

From here you can overlay the index and set some rules based on what should have been a good indication of a Bull market and what was a good indication of a Bear market. Below is the chart with the overlay (right-click and select Overlay Left Scale):

Looking at the chart, it seems that a good measure is when our breadth value is over 75% to say that is a Bull market and less than 30% would indicate a Bear market. We can show this on the chart by adding a Show View tool in conjunction with a Switch script. The script is SWITCH(CLOSE() > 75, CLOSE()<30)

You can drag and drop the Show View over the chart and reduce its transparency so that you can easily see how the zones correlate to the market movements.

You can see the above example that a 200-day WMA is a good measure although it is very late in the moves, as you would expect with any technique constructed from a 200-day moving average. In Optuma there are many different Breath measures that can be explored.

From Optuma 2.0 and onward, you can now build Custom Breadth measures with over 10 years of history.

Please Wait!

Please wait... it will take a second!