Creating custom index in Index-Lab
Author: Ruschem
Creation Date: 12/29/2011 11:04 AM
profile picture


Is it possible to create Custom Index other than the pre-built set in the initial Index-Lab view? The last image in the help file "Index-Lab>Custom Indexes>Index Naming, % Prefix" lead me to believe that I can create my own index using Standard Indicators but I couldn't find a way to do it. If creating custom indexes is possible, please help me learn how to do it.

In particular, I am interested in creating a custom index that counts % new 20 day lows (or better the difference between % new 20 day high and new 20 day lows) on S$P500 stocks.

A problem that I noticed with pre-built indexes is that it takes a long time to calculate them. It seems that custom indexes are calculated every time anew instead of storing the old data and only adding new data to the existing set. Is it possible to speed up the process by storing the existing data? If so, how can I do it?

Thank you very much for your help.

profile picture


Is it possible to create Custom Index other than the pre-built set in the initial Index-Lab view?

Of course it's possible. Here's an instruction in PDF and an open source demo project illustrating how to build custom IndexDefinitions using any C# IDE:

* Wealth-Lab Version 6 (.NET) Development Guide > Create a Custom Index
* MS123 IndexDefinitions - Home > Download IndexDefinition library demo
In particular, I am interested in creating a custom index that counts % new 20 day lows (or better the difference between % new 20 day high and new 20 day lows) on S$P500 stocks.

You need the New n-bar Highs/Lows IndexDefinition from our MS123 IndexDefinitions library extension. Install, restart WLP, build the two indices (20-day highs and 20-day lows) adn then do whatever you please with them using GetExternalSymbol e.g.

Please log in to see this code.

On a related note, an entire chapter in Gregory Morris' book "The Complete Guide to Market Breadth Indicators" is dedicated to the subject of the various New High New Low ratios.
profile picture


Thank you very much - your support is nothing short of superb. Your reply was the type of "all you wanted to know but were afraid to ask".

One question still remains: what can I do to speed up the calculation. I tried only %new20daylows on NASDAQ100 index. It took about three minutes on my computer with 4GB memory and Pentium 4 processor. No other programs were running.
profile picture


Thank you.

To speed up index processing,

1) Disable Data on Demand. See Index-Lab > Index Calculation in the WL User Guide.
2) Get rid of that Pentium 4. Seriously. I can't notice any slowdown even on a 4 year old Core 2 Duo laptop - let alone my present-day development machine. You'll be surprised that with an Intel i7 or a six-core AMD, it'd take let's say 30 seconds.
profile picture


Everything is perfect now. Instead of opening the Index indicator from the menu pane or chart, I calculate them in the Data Manager. But the neat trick was turning off the "on demand" option for the calculations. All newly created custom indexes are loading very quickly and even initial calculations is faster. Having a new and better computer wouldn't hurt as well :)

Your help is greatly appreciated.
profile picture


Not sure if this is the right place to ask this but it seems related.

I'd like to create a custom index that tells me for a dataset the percentage of the symbols in the dataset for whom

CumDown.Value(bar, Close, 1) >= some specified number of days

I didn't see how to do that in Index lab and if possible, I would like to avoid using Visual Studio to do it (though one of my 2014 goals is to learn to use it)

Thanks for the help
profile picture


Install the MS123 IndexDefinitions library and look for the index called "Above (below) an indicator's value". This returns the number of stocks satisfying a criterion as an absolute value. Converting it to percentage in your strategy is all what's left to do.

MS123 IndexDefinitions library
MS123 IndexDefinitions - Home
profile picture


Thanks Eugene,

Just tried it.

What I don't see is how to convert it to a percentage.

The symbols may have differing numbers of bars so the total number of symbols included vary over time.

Where in the definition do I tell it to divide by the total number of symbols

profile picture


For all practical purposes, consider it static and use the DataSetSymbols.Count.
profile picture


Two things

1) The smaller the count, the more this will matter but I will use it

2) I am getting an error when I try to update data.

In Update Data the messge reads "Error: Error: Invalid Indicator Settings"

Here is how I define the index. Perhaps I am doing something wrong

In Index Lab

Index Builder Tab --> Left Hand Side --> Above Indicator's Value --> Right Hand Side --> Pick a Dataset --> Next

Select Indicators --> CumDown
Source --> Close
Lookback --> 1
Indicator Value --> 3

I am looking for the number of symbols in the Dataset that have experienced 3 consecutive down closes on a particular bar

Did I define it incorrectly?

profile picture


This bug is known:

Open Issues > Invalid indicator settings error

I'm sorry but WLP users will have to live with this until Fidelity fixes it in a future build. As a workaround, I can show you how to create your custom index in a WealthScript Strategy, but for that please start a new forum thread in WealthScript forum since it would be off-topic in this thread.