kgriffen 49 posts msg #32616 - Ignore kgriffen |
7/18/2004 8:26:05 PM
I have built a trend reversal filter, and I would like to see if ANY bullish candlesticks happened within the last five days. I can do this for one pattern, but I would like to see if any of the 20 or so bullish patterns have happened. Is there an OR function? I can't find it.
|
cegis 235 posts msg #32618 - Ignore cegis |
7/19/2004 10:45:10 AM
kgriffen,
You can use the set{} and count() functions to implement OR:
The count() function is documented in the Announcements forum, under a thread entitled something like New Feature: Occurrences.
In this case, isprice will be 1 if the price is less than 10, or zero otherwise, and isvol will be 1 if the volume is greater than a million, or zero otherwise. Adding the two together gives the result of OR: If 'or' is greater than zero, then at least one of isprice or isvol is equal to one.
There are MANY filters throughout the forums that use this technique, if you want to see other implementations. (You can use this for ANY logic you care to "program".)
HTH,
C
|
kgriffen 49 posts msg #32623 - Ignore kgriffen |
7/19/2004 7:21:20 PM
cegis,
Thanks for the formula! I now realize my question was not as clear as I meant it to be. The formula I am using is this:
show stocks where close is above open
and ema(14) reached a new 5 day low 1 day ago
and ema(14) is above ema(14) 1 day ago
and apply to watchlist(sp100)
What I want to add to this formula is a way to see if in the last X days, any Candlestick Formations (i.e. Bullish Engulfing, Three White Soldiers, Bullish Harami, etc.) have also been present in that particular security. If I could use some sort of OR function, I could simply string them all together.
I use this simple EMA formula to swing trade. I only trade SP100 stocks, I only trade the trend, and I like to make 2%-5% profit in a few days on a stock and get out. When the EMA(14) starts to head up, I find the first white candle and set the high of that day as my entry point into the market, and the low of that day as the Stop Loss.
I am adding this tweak to a filter that already gives me good results, but I think it would be more effective if I could spot more easily the known Japanese Candlestick formations, further strengthening my opinion of a potential positive move. Along the same lines, I would like to check the slope of the EMA(14) on the way down, but that doesn't seem to work quite right either. Any idea on how to check the slope of the last X days, but not include today?
Thanks for your help! I will use what you sent in another filter I am using.
kg
|
cegis 235 posts msg #32625 - Ignore cegis |
7/19/2004 8:37:23 PM
kgriffen,
I used the filter example that I did to show you the technique, as I'm not positive of the syntax for checking specific candlestick patterns. But, if you put the check in the count() function within the set{} command, you will end up with a variable that's 1 if the pattern is there, or 0 if it is not. Your filter may look something like this:
If my syntax is correct, this should add the requirement that the stock is also in either a bullish engulfing or bullish harami. It should be straight forward to add other patterns.
As for checking the slope excluding today, the phrase would be "3 day slope of ema(14) 1 day ago". Remember that the slope value is the slope of a best-fit line over the number of days, not necessarily based on the endpoints of the ema(). (What doesn't seem right about the slope?)
HTH,
C
|
kgriffen 49 posts msg #32636 - Ignore kgriffen |
7/20/2004 6:30:25 PM
cegis,
It is so simple, it is beautiful! I will try it out tonight and let you know the results!
thank you, thank you, thank you!
|