indicators which need to go through a specific dataset
Author: tradercn
Creation Date: 7/26/2011 11:10 AM
profile picture

tradercn

#1
Hi Eugene,

I have a Dataset which contains over 2000 symbols. I want to create two indicators. One is the percentage of the symbols which SMA(50) is greater than SMA(200). The second is the percentage of the symbols which close at 10% higher than previous close. These two indicators need to go through a dataset, how can I do it? Do you have any example how to go through a dataset? Thanks.
profile picture

Eugene

#2
You can do it in WealthScript.

But the most convenient way is to develop an IndexDefinition. This is much more natural for this job. Next month we'll be releasing our MS123 IndexDefinitions library (and a demo source code to help motivated users develop their own indices).

Unfortunately, the first indicator will not be possible to create (and I can't promise that it will be added later). So here goes the first one, percentage of symbols with SMA1>SMA2 vs SMA1<SMA2:
CODE:
Please log in to see this code.


The 2nd one is much easier. A new IndexDefinition will be included in our library to count the number of stocks above (or below) an indicator's value. "Close at 10% higher than previous close" is simply the 1-day ROC of closing price. When our library is out, you'll select that index in Index Manager, select ROC from the list, and to find the number of stocks with a close-to-close change of 10% and higher you'll enter "10" in the input box.
profile picture

tradercn

#3
Many thanks. You solved my problems. :)
profile picture

Eugene

#4
I'm glad I could help.
profile picture

tradercn

#5
One more question for the second indicator. Since a lot of new stocks are public traded every day, how can I count the total number of the stocks in the market everyday? I want to make an indicator which equals to the percentage of the stocks which makes over 10% higher than previous close in the total number of the stocks. How to do that please? Thank you.
profile picture

Eugene

#6
Please read my reply dated 7/26/2011 11:52 AM (near the bottom of it).
profile picture

tradercn

#7
Thanks a lot. :)
profile picture

Eugene

#8
tradercn,

With the release of our MS123 IndexDefinition library, you can now easily roll out this index:

QUOTE:
The second is the percentage of the symbols which close at 10% higher than previous close.


Here's a how-to after installing the extension and restarting Wealth-Lab:

1. Open Index Manager, then Index Builder
2. Scroll the list down to 'Number of stocks Above an Indicator's value'
3. Select ROC from the list, period = 1, price = Close (1-day close-to-close price change)
4. Enter 10 in the input box titled "Indicator value"
5. Finish building the index, open its chart from "Index-Lab Daily" from the DataSets tree and you're done.
profile picture

tradercn

#9
Hi Eugene,

Thanks so much for your latest information. After I followed your step, I saw the indx-lab Daily as a new dataset, I double clicked the indicator there, it shows "Error: Invalid indicator settings. Unable to get Data for index %ZTS".

Second, if you look at my questions above, how can I get the % as I mentioned through the index builder then?

There are two improvements you can do for the index builder at least so far. First, in the Index Builder, all the items there is not sorted; Second, they are showed partially. Just FYI.

Thanks so much. Honestly, I am jealously to your team manager have you as a team member here. You've been very helpful all the time.
profile picture

Eugene

#10
QUOTE:
After I followed your step, I saw the indx-lab Daily as a new dataset, I double clicked the indicator there, it shows "Error: Invalid indicator settings. Unable to get Data for index %ZTS".

"Invalid indicator settings" error is produced when you clicked on 'Above/Below Indicator Value' and then have not selected an indicator from the list. This is expected in this 3-step procedure:

1. The idea of this Index is to be able to select any indicator from any given indicator library, be it Williams %R, ROC, PVI, LaguerreRSI or whatever.
2. Then you configure its settings.
3. Finally, you enter a value for the indicator to be above above or below.
QUOTE:
There are two improvements you can do for the index builder at least so far. First, in the Index Builder, all the items there is not sorted; Second, they are showed partially. Just FYI.

1. This is by design and we'll have to live with it. There are two IndexDefinition libraries, the built-in ends with Tsokakis MACDBull/MACDBear and the newly installed items start after it.
2. Since you haven't shown us a screenshot and everything looks fine here, I can only speculate what exactly is shown partially: their names in the list of Custom Indexes or is it in the Index Builder tab? In the first case, the system font must be too large and in the 2nd case, just expand the Index Manager window so that all elements of the interface could fit.

Thanks for the kind words.
profile picture

tradercn

#11
Thanks for your quick response.
How can I upload picture here please? I could not see the upload button.
profile picture

Eugene

#12
To post an image, upload it first to any free image hoster (tinypic.com, imageshack.us, imagebam.com - to name a few). Then:

* either retrieve the direct link to the full-size image and paste the link right between a pair of IMG tags (you should see a pane with "...LINK, QUOTE, CODE, IMG" buttons when adding a new post),
* or use a code snippet "for posting on the forums" (usually, every image hoster provides it).
profile picture

tradercn

#13
Hi Eugene,
After I created the indicator (%ZTS), it shows as here

It is great so far.
Now I changed my idea a little bit. Since in China stock market, stock price change has daily limitation +/-10%. The maximum increase or decrease can not be greater than 10% compare to the previous close?I want to create an indicator, called Market Strength, which is a ratio:
Market Strength = (total number of the stock which increase 10% / total number of the stock which decrease 10%) - 1
Can I make that through the index builder?
Second, look at the image I upload please. It shows a small point which is not clear, can I show it as a bar?
For the index builder, is that possible to generate indicators as normal, for example MACD, RSI, so that I can plot them under some charts?
Many Thanks.
profile picture

Eugene

#14
QUOTE:
Market Strength = (total number of the stock which increase 10% / total number of the stock which decrease 10%) - 1
Can I make that through the index builder?

Sure it's possible, but somebody has to program it as an IndexDefinition using Visual Studio first.
QUOTE:
Second, look at the image I upload please. It shows a small point which is not clear, can I show it as a bar?

It is a bar but with O=H=L=C. Each bar is the number of stocks greater/less than an indicator's value. How can you make one number become a bar which typically has 4 different values (rhetorical question, no need to answer)? The easiest way is to switch to Line chart view.
QUOTE:
For the index builder, is that possible to generate indicators as normal, for example MACD, RSI, so that I can plot them under some charts?

Unless you did mean to create aggregate indicators, the Index Manager is not an indicator generator. Please refer to the User Guide (Help menu) for a description of its features and purposes.
profile picture

tradercn

#15
Thanks Eugene. I got it. Have a great weekend.
profile picture

Eugene

#16
Hey tradercn,

Where have you found this indicator? I couldn't seem to find any trace.

What's the point of subtracting 1 (one) here? What's your interpretation?
QUOTE:
Market Strength = (total number of the stock which increase 10% / total number of the stock which decrease 10%) - 1


If I was to make an oscillator ranging from 0 to 100, see how it would look like:
QUOTE:
100 - 100/(1+(adv / dec)), where:

* 'adv' = total number of the stock which increase N%
* 'dec' = total number of the stock which decrease N%

I'm thinking of including two versions in our library: the oscillator and a simple ratio of 'adv' / 'dec'.
profile picture

tradercn

#17
Hi Eugene,
In my understanding, this is the indicator only used for China's stock market since it limits the daily up and down limitation as 10%. Subtracting 1 here will make the indicator positive when total number of the stock which increase 10% more than that of the stock which decrease 10%.
Yes, the oscillator adv/dec to show almost the same meaning, but can we assign the up and down change % in adv/dec? If it is yes, then it should be ok.
profile picture

Eugene

#18
I envision a more universal application if the up/down change % is made configurable. Other markets might not have trading curbs like that. It will be possible to specify the percentage of the day-to-day close price change when setting up the index.
profile picture

tradercn

#19
That's great! Thanks for your effort to help us. :)
profile picture

Eugene

#20
Here you go tradercn,

Market Strength available in the latest update - both as oscillator and ratio.

Be sure to check out its formula in the Wiki. Subtracting -1 is not required, it didn't make sense to me.