StockFetcher Forums · General Discussion · Ave Vol of Past White Candles Only<< >>Post Follow-up
53 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.


235 posts
msg #32560
Ignore cegis
7/12/2004 11:12:37 AM


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.



53 posts
msg #32570
Ignore chessnut1
7/13/2004 12:13:14 AM


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. :)

Fetcher[find stocks where close is between 1 and 10 and average volume(90) is above 100000 and

set{white10,count(close 10 days ago is greater than open 10 days ago,1)}
set{white9,count(close 9 days ago is greater than open 9 days ago,1)}
set{white8,count(close 8 days ago is greater than open 8 days ago,1)}
set{white7,count(close 7 days ago is greater than open 7 days ago,1)}
set{white6,count(close 6 days ago is greater than open 6 days ago,1)}
set{white5,count(close 5 days ago is greater than open 5 days ago,1)}
set{white4,count(close 4 days ago is greater than open 4 days ago,1)}
set{white3,count(close 3 days ago is greater than open 3 days ago,1)}
set{white2,count(close 2 days ago is greater than open 2 days ago,1)}
set{white1,count(close 1 days ago is greater than open 1 days ago,1)}

set{vol10, count(white10 multiplied by volume 10 days ago)}
set{vol9, count(white9 multiplied by volume 9 days ago)}
set{vol8, count(white8 multiplied by volume 8 days ago)}
set{vol7, count(white7 multiplied by volume 7 days ago)}
set{vol6, count(white6 multiplied by volume 6 days ago)}
set{vol5, count(white5 multiplied by volume 5 days ago)}
set{vol4, count(white4 multiplied by volume 4 days ago)}
set{vol3, count(white3 multiplied by volume 3 days ago)}
set{vol2, count(white2 multiplied by volume 2 days ago)}
set{vol1, count(white1 multiplied by volume 1 days ago)}

and set{Sum1, count(vol10 + vol9)}
set{Sum2, count(Sum1 + vol8)}
set{Sum3, count(Sum2 + vol7)}
set{Sum4, count(Sum3 + vol6)}
set{Sum5, count(Sum4 + vol5)}
set{Sum6, count(Sum5 + vol4)}
set{Sum7, count(Sum6 + vol3)}
set{Sum8, count(Sum7 + vol2)}
set{Sum9, count(Sum8 + vol1)}

set{TotalWhites1, count(white10 + white9)}
set{TotalWhites2, count(TotalWhites1 + white8)}
set{TotalWhites3, count(TotalWhites2 + white7)}
set{TotalWhites4, count(TotalWhites3 + white6)}
set{TotalWhites5, count(TotalWhites4 + white5)}
set{TotalWhites6, count(TotalWhites5 + white4)}
set{TotalWhites7, count(TotalWhites6 + white3)}
set{TotalWhites8, count(TotalWhites7 + white2)}
set{TotalWhites9, count(TotalWhites8 + white1)}

set{AvgVolWhites, Sum9/TotalWhites9}
and volume is more than 10 percent above AvgVolWhites
and add column AvgVolWhites
and set{VolDiff, volume - AvgVolWhites}
and set{VolRatio, VolDiff/AvgVolWhites}
and set{Vol%Chg, VolRatio * 100}
and sort column Vol%Chg descending


53 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.


235 posts
msg #32577
Ignore cegis
7/13/2004 4:23:13 PM


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):

set{myvol, count(close is greater than open,1) multiplied by volume}
set{Sum9, sum(myvol,10)}

set{TotalWhites9, count(close is greater than open,10)}

set{AvgVolWhites, Sum9 / TotalWhites9}

set{VolDiff, volume - AvgVolWhites}
set{VolRatio, VolDiff / AvgVolWhites}
set{VolPctChg, VolRatio * 100}

close is between 1 and 10 and average volume(90) is above 100000
and volume is more than 1 percent above AvgVolWhites

add column AvgVolWhites

add column VolPctChg

sort column 6 descending



P.S., If you don't understand how the sum() is working, let me know...

53 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.

set{diff, close - close 1 day ago}
set{product, diff * volume},
show stocks where sum(product,10) crossed above 0

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!


235 posts
msg #32591
Ignore cegis
7/16/2004 9:42:38 AM


Gee wiz! I blush!

The sum() function actually makes this technique usable for ANY length of time.

Glad I could help.


StockFetcher Forums · General Discussion · Ave Vol of Past White Candles Only<< >>Post Follow-up

*** Disclaimer *** does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. does not recommend particular securities., Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.

Copyright 2018 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus