glgene 616 posts msg #40144 - Ignore glgene |
1/11/2006 2:05:31 PM
How do you put a "1" in a designated column if a certain condition is met, and how do you put a "0" in a designated column if a certain condition is not met?
Example: If a stock's fast MACD (12,26,9) is above its slow MACD, then put a "1" to a column (called MACD); otherwise it's a 0.
Or, if a stock's OBV is greater than 0, put a "1" in a column (called OBV); otherwise it's a 0.
Or, if a stock's close is above its 30-day EMA, put a "1" in that column (called Close); otherwise, it's a 0.
Finally, I need to calculate a total of these point columns (called Total), which in the above example if all conditions were positive, the total score would be 3. (Or it could be 0, 1, or 2).
I want to track 6-7 variables, so the Total would be a maximum of the number of variables.
Can anybody help me with this one? Thanks in advance.
GL Gene
|
nikoschopen 2,824 posts msg #40148 - Ignore nikoschopen |
1/11/2006 2:58:51 PM
set{test, count(MACD fast line(12,26,9) crossed above MACD slow line(12,26,9),1)}
and Average Volume(90) is above 50000
and close is between 5 and 250
add column test
|
nikoschopen 2,824 posts msg #40149 - Ignore nikoschopen |
1/11/2006 3:07:34 PM
The following should come close to what you're looking for:
set{test1, count(MACD fast line(12,26,9) crossed above MACD slow line(12,26,9),1)}
set{test2, count(OBV above OBV 1 day ago,1)}
set{test3, count(close above EMA(30),1)}
set{testsum1, test1 + test2}
set{testsum, testsum1 + test3}
and Average Volume(90) is above 50000
and close is between 5 and 250
add column testsum
|
alf44 2,025 posts msg #40150 - Ignore alf44 |
1/11/2006 3:07:46 PM
glgene,
Ya gotta use the "count" !
See below :
------------------
--------------------
Is that pretty much what you had in mind ?
Regards,
alf44
PS. I used NASDAQ 100 as a Stock Universe. You can obviously use whatever you wish !
|
nikoschopen 2,824 posts msg #40151 - Ignore nikoschopen |
1/11/2006 3:11:03 PM
forgot to make it a hyperlink...
|
glgene 616 posts msg #40152 - Ignore glgene |
1/11/2006 3:30:34 PM
That's what I was looking for!! Thanks Alf and Niko. I assume I can use that on a Watchlist, too.
|
alf44 2,025 posts msg #40155 - Ignore alf44 |
1/11/2006 3:54:16 PM
...yep gene...
just include the phrase "apply to watchlist(whateverwatchlist)" !
You should be good to go !
Good Luck !
alf44
|