chessnut1 58 posts msg #32555 - Ignore chessnut1 |
7/11/2004 9:03:45 PM
Can anyone come up with a way to search for stocks where volume is 2 times greater than the average volume over the last X-number of WHITE [only] Candle days?
My interest is to know how to phrase the average volume of the past 5 white-candle days, skipping, or not counting, the volume of intervening red-candle days.
I am interested in this because a search for volume spikes on the basis of comparing current volume with past X number of days' volume does not differentiate between buying and selling volume.
I realize that one wide-brushed solution is to compare the current day's volume with a longer past period, say, average volume(90), but when I want to compare the current up-day's volume to volume of the past 10 days without counting the red candle days, I'd love to have a way to do that.
Thanks in advance.
--BJ
|
cegis 235 posts msg #32560 - Ignore cegis |
7/12/2004 11:12:37 AM
BJ,
Since you are looking at a limited number of days, you can use count() function withing the set{} command to program this yourself.
Basically, you'd check each day to see if "the candle is white" by doing something like "set{white10,count(close 10 days ago is greater than open 10 days ago,1)}". This will leave "white10" equal to 1 if the "candle was white" 10 days ago. (It'll be zero otherwise.) You can then multiply volume 10 days ago by white10 to get the white volume. Do this for all 10 days, summing the volume and the "white" values, and finally divide to get the "average white volume".
There are quite a few posts here that explain using count() and set{} in this way, so if you need a bigger nudge, just look around.
HTH,
C
|
chessnut1 58 posts msg #32570 - Ignore chessnut1 |
7/13/2004 12:13:14 AM
cegis,
Thanks for pointing me in the right logical direction. I may need another nudge however in getting the syntax worked out right, because the following is my best shot, and it's not working. Hope you can point out the error of my ways. :)
--BJ
|
chessnut1 58 posts msg #32571 - Ignore chessnut1 |
7/13/2004 12:17:28 AM
As you can tell, I even dropped my ambitious search for 2 times ave volume to a mere 10 percent increase over average volume in order to be sure I wasn't getting 0 returns because of the high requirement. But even with the 10% it produces zip.
--BJ
|
cegis 235 posts msg #32577 - Ignore cegis |
7/13/2004 4:23:13 PM
BJ,
First, I see a few syntax problems. In the calculations for vol*, Sum*, and TotalWhites*, you don't want the count(). You're just looking to do the simple math, not count the number of occurrences of anything.
Also, I'm not sure if the "%" character is usable in a variable name. I'd change it to "Pct".
Lastly, the "sort column" syntax is wrong. If I correctly understand how that works, the way you sort the results by a column is you need to "add column", then sort on the column *number* (which starts at 5 for the first "add column") within the result list.
However, even after making those changes, the filter still didn't run. :-{
Now, I know that there's a "length limitation" for the nesting of set{} commands, and it appears that you might have hit it. What I did to determine this, is remove any condition based on any of the set{}'s. This will allow results to be returned. I then added "add column" statements for all of the set{} variables. The columns for "white" and "vol" variables all showed up (seemingly correct) for the stocks returned. However, the Sum1 and Sum2 variables were the only ones of the Sum group that showed up. I even deleted what was there for Sum3 on, and re-typed it, and they still didn't show.
So, I needed to get the set{} length down. In a stroke of brilliance (if I do say so myself! <GRIN!!>), I found the sum() function, which allowed me to code all of those set{} commands to calculate the total white volume and days into THREE lines. That did the trick! Here's my result (I also arranged some lines so that it was easier for me to read):
Enjoy!
C
P.S., If you don't understand how the sum() is working, let me know...
|
chessnut1 58 posts msg #32589 - Ignore chessnut1 |
7/16/2004 3:48:21 AM
Wow, that WAS brilliant, cegis! The sum feature was the perfect solution.
(If others are interested in the sum feature, it is found under the Announcements Section of the Forum, in the "More Math functions Available" thread). Actually, since it is so short, I'll just reproduce it here:
sum(IND,LENGTH): return the sum of a measure, over the specified length.
Thanks again for the creative solution! For my purpose I tweaked the filter you posted by adding, "and close above high," so that the most recent candle is always white.
Great job cegis!
--BJ
|
cegis 235 posts msg #32591 - Ignore cegis |
7/16/2004 9:42:38 AM
BJ,
Gee wiz! I blush!
The sum() function actually makes this technique usable for ANY length of time.
Glad I could help.
C
|