Is it possible to create filter and custom column?
Author: Karthik
Creation Date: 4/13/2009 3:13 PM
profile picture

Karthik

#1

Hi,

I'm new to WL. I like to know the below two are possible or not, if possible please
point me where i can learn to do that....

1. Is it possible to apply the filter criteria on one or more DataSet and list the the stocks which are
met the filter criteria.
(e.g. Filter condition: % Change > 5 AND 50-DMA > 200-DMA etc conditions)

2. If the above is possible, while listing the results, can i add the custom column on the fitler result?
(e.g. Custom Column Definition: %off 50-DMA, 50-DMA Price, and etc.,)

I really appreciate your help.
profile picture

Eugene

#2
1. Yes, it is possible to apply the filter to one DataSet at a time (by running in a Strategy window) or on multiple DataSets (using the Strategy Monitor tool). Please see the WealthScript Programming Guide, Techniques > Creating a Screener for more.
2. I'm afraid there's no method available to create a custom column, but you can get one column by utilizing the signal name column in the Alerts tab -- see the link above.
CODE:
Please log in to see this code.
profile picture

Karthik

#3
Thanks for your quick response, let me try it.
profile picture

Cone

#4
Here's a Debug Window solution. Paste the code in the Editor and compile it. Perform a Data Update. Put the symbols in a DataSet, set the Data Loading control for 200 bars, click on the DataSet name and run it.

CODE:
Please log in to see this code.
If nothing besides the header prints in the Debug window, then nothing passed the filter.
profile picture

Eugene

#5
Almost forgot to mention: the final value of each data series is automatically displayed in the By Symbol tab.
So request #2 is feasible too, given that you need a screener for the last bar it makes sense.
profile picture

Karthik

#6
Thanks a lot Cone & Eugene.....
profile picture

Karthik

#7
In the above code, Is it possible to loop-through all the datasets?
profile picture

Eugene

#8
Short answer: for all practical purposes, no.
Long answer: Iterate through datasets
profile picture

jeffisw

#9
I want to list stocks with ROC for multiple periods such as 1 month, 3 months and 6 months and export it to excel. With WealthLab 4, I used the scanner tool with custom columns. I see from your answers above that two ways to do this with WealthLab 6:
1. Alerts signal name. This method provides only one value.
2. Debug window.
I understand these two ways.

Eugene, what do you mean by: "So request #2 is feasible too, given that you need a screener for the last bar it makes sense."

So there is no easy standard tool to create a list of stocks with multiple values?
profile picture

Eugene

#10
In addition to Alerts and Debug window, with Wealth-Lab 6 there are numerous ways to skin this cat:

3. Copy to clipboard, paste elsewhere
4. Save to file, open elsewhere
5. Create a custom window inside Wealth-Lab interface (good development skills required)
...Anything else one can think of in .NET

And of course, the Debug window remains the easiest standard tool to create this list of stocks.
profile picture

Cone

#11
1. Strings are very flexible. For more than one value, just add a delimiter between each value. Use a comma or tab for instant Excel compatibility.

2...

3. You can get all these values directly with the "By Symbol" visualizer. For this to work you need to a) run a multi-symbol test (or create a DataSet with only 1 symbol in it, and, b) add synchronized series to the Bars.Cache manually, like this:

CODE:
Please log in to see this code.


4. Since you want to "export to Excel" anyway, the straightforward method is to write delimited values to a file.
profile picture

jeffisw

#12
Thank you for your prompt response. I think I will write delimited values to a file and open with excel.
profile picture

kiewo

#13
Hi,

In regards to Cone´s code example ("Assumes +5% change from yesterday"):

Is there a possiblity to sort the data by its roc value before printing it to the Debug window?

Many thanks in advance!
profile picture

Eugene

#14
Hi,

1. Yes, if you change the strategy's logic to loop over DataSetSymbols and run the code in single-symbol mode - like shown in the QuickRef (see SetContext or FirstActualBar) or this thread (post #17):

Print out a created list

2. An alternative that doesn't require the logic change would be to store the ROC values in a class-level collection and print out the results when processing the last symbol of DataSet:

CODE:
Please log in to see this code.
profile picture

kiewo

#15
Many thanks!
profile picture

Eugene

#16
You're welcome.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).