StockFetcher Forums · General Discussion · Intraday Trades<< 1 2 3 >>Post Follow-up
jkiehle
13 posts
msg #33138
Ignore jkiehle
9/5/2004 2:15:37 AM

Rob,

Of this section of the code:

and set{x0,count(ratio0 is above 0.03,1)}

the variables x0.......x10 do not seem to be getting a value so I am not able to add them up and evaluate the result. Any ideas why?

Jonathan



jkiehle
13 posts
msg #33141
Ignore jkiehle
9/5/2004 9:30:31 AM

Rob,

Hear is current code:
set{delta0,high minus low}
set{ratio0,delta0 divided by close}
set{x0,count(ratio0 is above 0.03,1)}
set{delta1,high 1 days ago minus low 1 day ago}
set{ratio1,delta1 divided by close 1 days ago}
set{x1,count(ratio1 is above 0.03,1)}
set{delta2,high 2 days ago minus low 2 day ago}
set{ratio2,delta2 divided by close 2 days ago}
set{x2,count(ratio2 is above 0.03,1)}
set{delta3,high 3 days ago minus low 3 day ago}
set{ratio3,delta3 divided by close 3 days ago}
set{x3,count(ratio3 is above 0.03,1)}
set{delta4,high 4 days ago minus low 4 day ago}
set{ratio4,delta4 divided by close 4 days ago}
set{x4,count(ratio4 is above 0.03,1)}
set{delta5,high 5 days ago minus low 5 day ago}
set{ratio5,delta5 divided by close 5 days ago}
set{x5,count(ratio5 is above 0.03,1)}
set{delta6,high 6 days ago minus low 6 day ago}
set{ratio6,delta6 divided by close 6 days ago}
set{x6,count(ratio6 is above 0.03,1)}
set{delta7,high 7 days ago minus low 7 day ago}
set{ratio7,delta7 divided by close 7 days ago}
set{x7,count(ratio7 is above 0.03,1)}
set{delta8,high 8 days ago minus low 8 day ago}
set{ratio8,delta8 divided by close 8 days ago}
set{x8,count(ratio8 is above 0.03,1)}
set{delta9,high 9 days ago minus low 9 day ago}
set{ratio9,delta9 divided by close 9 days ago}
set{x9,count(ratio9 is above 0.03,1)}
set{delta10,high 10 days ago minus low 10 day ago}
set{ratio10,delta10 divided by close 10 days ago}
set{x10,count(ratio10 is above 0.03,1)}
set{y1, x0 + x1}
set{y2, y1 + x2}
set{y3, y2 + x3}
set{y4, y3 + x4}
set{y5, y4 + x5}
set{y6, y5 + x6}
set{y7, y6 + x7}
set{y8, y7 + x8}
set{y9, y8 + x9}
set{y10, y9 + x10}

Show stocks where y10 is above 50
and delta0 is above 0.40
and delta1 is above 0.40
and delta2 is above 0.40
and delta3 is above 0.40
and delta4 is above 0.40
and delta5 is above 0.40
and delta6 is above 0.40
and delta7 is above 0.40
and delta8 is above 0.40
and delta9 is above 0.40
and delta10 is above 0.40

I have tried dozens of iterations and have tested the contents of the x variables and they seem to be empty but I don't know how to get them to display.







robdavis
69 posts
msg #33146
Ignore robdavis
9/5/2004 2:55:30 PM

Jkiehle,

If you're working with 10 days, then, instead of saying...

and set{y0,x+x0}
and set{y1,x0+x1}
and set{y2,x1+x2}
and set{y3,x2+x3}
and set{y4,x3+x4}
and set{y5,x4+x5}
and set{y6,x5+x6}
and set{y7,x6+x7}
and set{y8,x7+x8}
and set{y9,x8+x9}
and set{y10,x9+x10}

and y10 is above 15

I'd say...

and set{y1,x0+x1}
and set{y2,x1+x2}
and set{y3,x2+x3}
and set{y4,x3+x4}
and set{y5,x4+x5}
and set{y6,x5+x6}
and set{y7,x6+x7}
and set{y8,x7+x8}
and set{y9,x8+x9}

and y9 is above 5

As you can see, I've deleted the very first and last line of the code. Because there are only 9 steps, when we want to obtain a sum of 10 values.

Also, as you can see, I've changed the 15 to a 5, because, ideally we want to put a "4", or "5", or "6" value there, but, certainly, in this code we do not want to give the computer a value greater than "10". Because that'd be too demanding of us of the computer, and of the data base of stocks, resulting in a message similar to the following, "Your search has returned ZERO stocks."

Also, one needs to understand, all these 10 lines of code do is tell the computer to calculate the sum of y0+y1+y2+... +y10. I wish we could simply tell the computer, "y9 = x0+x1+x2+... +x9", or, alternatively, "set{y9,x0+x1+x2+... +x9}", but, to my best knowledge, we can't.

Also, one needs to understand, we simply tell the computer to be happy with the results if this (10-day) sum is at least a 5.

I hope this helps.

Rob


robdavis
69 posts
msg #33147
Ignore robdavis
9/5/2004 3:05:47 PM

Jonathan,

> Of this section of the code
> and set{x0,count(ratio0 is above 0.03,1)}
> the variables x0.......x10 do not seem to be getting a value so I am not able to add them up and evaluate the result. Any ideas why?

As soon as your code yields a stock, any stock, temporarily you might want to add the following three lines of code to your code. This way you can do some serious, additional, trouble shooting:

and add column delta0
and add column ratio0
and add column x0

I hope this helps.

Rob


jkiehle
13 posts
msg #33148
Ignore jkiehle
9/5/2004 4:27:22 PM

Rob, This is what I finally came up with There is a ton of ways to tweak it and it gets me what I was looking for.

Thanks for all of the help.

Jonathan

set{delta0,high minus low}
set{ratio0,delta0 divided by close}
set{delta1,high 1 days ago minus low 1 day ago}
set{ratio1,delta1 divided by close 1 days ago}
set{delta2,high 2 days ago minus low 2 days ago}
set{ratio2,delta2 divided by close 2 days ago}
set{delta3,high 3 days ago minus low 3 days ago}
set{ratio3,delta3 divided by close 3 days ago}
set{delta4,high 4 days ago minus low 4 days ago}
set{ratio4,delta4 divided by close 4 days ago}
set{delta5,high 5 days ago minus low 5 days ago}
set{ratio5,delta5 divided by close 5 days ago}
set{delta6,high 6 days ago minus low 6 days ago}
set{ratio6,delta6 divided by close 6 days ago}
set{delta7,high 7 days ago minus low 7 days ago}
set{ratio7,delta7 divided by close 7 days ago}
set{delta8,high 8 days ago minus low 8 days ago}
set{ratio8,delta8 divided by close 8 days ago}
set{delta9,high 9 days ago minus low 9 days ago}

set{highdiff0,abs(high 1 day ago minus high)}
set{highdiff1,abs(high 2 days ago minus high 1 days ago)}
set{highdiff2,abs(high 3 days ago minus high 2 days ago)}
set{highdiff3,abs(high 4 days ago minus high 3 days ago)}
set{highdiff4,abs(high 5 days ago minus high 4 days ago)}
set{highdiff5,abs(high 6 days ago minus high 5 days ago)}
set{highdiff6,abs(high 7 days ago minus high 6 days ago)}
set{highdiff7,abs(high 8 days ago minus high 7 days ago)}
set{highdiff8,abs(high 9 days ago minus high 8 days ago)}
set{highdiff9,abs(high 10 days ago minus high 9 days ago)}

set{lowdiff0,abs(low 1 day ago minus low)}
set{lowdiff1,abs(low 2 days ago minus low 1 days ago)}
set{lowdiff2,abs(low 3 days ago minus low 2 days ago)}
set{lowdiff3,abs(low 4 days ago minus low 3 days ago)}
set{lowdiff4,abs(low 5 days ago minus low 4 days ago)}
set{lowdiff5,abs(low 6 days ago minus low 5 days ago)}
set{lowdiff6,abs(low 7 days ago minus low 6 days ago)}
set{lowdiff7,abs(low 8 days ago minus low 7 days ago)}
set{lowdiff8,abs(low 9 days ago minus low 8 days ago)}
set{lowdiff9,abs(low 10 days ago minus low 9 days ago)}

set{highratio0,highdiff0 divided by high}
set{highratio1,highdiff1 divided by high 1 days ago}
set{highratio2,highdiff2 divided by high 2 days ago}
set{highratio3,highdiff3 divided by high 3 days ago}
set{highratio4,highdiff4 divided by high 4 days ago}
set{highratio5,highdiff5 divided by high 5 days ago}
set{highratio6,highdiff6 divided by high 6 days ago}
set{highratio7,highdiff7 divided by high 7 days ago}
set{highratio8,highdiff8 divided by high 8 days ago}
set{highratio9,highdiff9 divided by high 9 days ago}

set{lowratio0,lowdiff0 divided by low}
set{lowratio1,lowdiff1 divided by low 1 days ago}
set{lowratio2,lowdiff2 divided by low 2 days ago}
set{lowratio3,lowdiff3 divided by low 3 days ago}
set{lowratio4,lowdiff4 divided by low 4 days ago}
set{lowratio5,lowdiff5 divided by low 5 days ago}
set{lowratio6,lowdiff6 divided by low 6 days ago}
set{lowratio7,lowdiff7 divided by low 7 days ago}
set{lowratio8,lowdiff8 divided by low 8 days ago}
set{lowratio9,lowdiff9 divided by low 9 days ago}

set {highvar1,highdiff0 + 0}
set {highvar2,highvar1 + highdiff2}
set {highvar3,highvar2 + highdiff3}
set {highvar4,highvar3 + highdiff4}
set {highvar5,highvar4 + highdiff5}
set {avghighvar, highvar5 / 5}

set {lowvar1,lowdiff0 + 0}
set {lowvar2,lowvar1 + lowdiff2}
set {lowvar3,lowvar2 + lowdiff3}
set {lowvar4,lowvar3 + lowdiff4}
set {lowvar5,lowvar4 + lowdiff5}
set {avglowvar,lowvar5 / 5}

Show stocks where volume 30 day low is greater than 20000
and close is between .50 and 30
and avghighvar is below .09
and avglowvar is below .09
and highratio0 is below .025
and highratio1 is below .025
and highratio2 is below .025
and highratio3 is below .025
and highratio4 is below .025
and lowratio0 is below .025
and lowratio1 is below .025
and lowratio2 is below .025
and lowratio3 is below .025
and lowratio4 is below .025
and delta0 is above 0.30
and delta1 is above 0.30
and delta2 is above 0.30
and delta3 is above 0.25
and delta4 is above 0.25
and delta5 is above 0.25
and delta6 is above 0.25
and delta7 is above 0.25
and delta8 is above 0.25
and delta9 is above 0.25



jkiehle
13 posts
msg #33160
Ignore jkiehle
9/6/2004 1:15:34 PM

Here is a much better method

set{delta, high - low}
set{ratio, delta / close}
set{ematest0, ema(5) - ema(2)}
set{ematest1, ema(10) - ema(5)}
set{ematest2, ema(15) - ema(10)}
set{emavar1, ematest0 + ematest1}
set{emavar2, emavar1 + ematest2}
set{avgemavar, emavar2 / 3}
set{growvar, delta / high}
Show stocks where Average Volume(30) is above 100000
and close is between .03 and 20
and abs(avgemavar) 11 day high is below .01
and delta 11 day low is above .02
and growvar 11 day low is above .03



the avgemavar controls the swing
the delta controls the range
the growvar does the same as the delta only it is by percentage



cegis
235 posts
msg #33165
Ignore cegis
9/7/2004 9:59:36 AM

Guys,

As a lesson in filter consolidation/writing, I offer the following, which is IDENTICAL to jkiehle's 9/5/2004 4:27:22 PM post:

Fetcher[
set{delta,high minus low}
set{ratio, delta divided by close}

set{hidiff, abs(high 1 day ago minus high)}
set{lowdiff, abs(low 1 days ago minus low)}

set{hiratio,hidiff divided by high}
set{lowratio, lowdiff divided by low}

set{avghivar, sum(hidiff,5) / 5}
set{avglowvar, sum(lowdiff,5) / 5}

volume 30 day low is greater than 20000
and close is between 0.50 and 30
and avghivar is below 0.09
and avglowvar is below 0.09
and count(hiratio is below 0.025,5) is equal to 5
and count(lowratio is below 0.025,5) is equal to 5
and count(delta is above 0.30,3) is equal to 3
and count(delta 3 days ago is above 0.25,7) is equal to 7
]



Well, let me change that "identical" thing: It's identical to what I think you wanted. When I tested this filter against the original, I got different results. I found that this was due to two reasons: First, for some reason (that I have not looked into too hard), the avglowvar condition on the original filter did not work. I added "add column avglowvar" to that filter, and got values in the 30's, not < 0.09. Second, I believe in the calculation of avghighvar and avglowvar, you really wanted to average the 5 consecutive days. The original filter missed adding in "highdiff1" and "lowdiff1".

Note the use of count() and sum() SERIOUSLY reduced the number of lines needed to code the filter. It also makes it easier to debug, or change parameters, since there's fewer parameters that would need to be changed! And, it also makes the mistake of missing a day's data (as was done, I think) impossible.

The last point here is, it reduces the complexity of the set{} commands. There is a known limitation in "nesting levels" of set{}s, where the filter will no longer return any results. That wasn't an issue here (unless that's the problem with avglowvar), but it can be.

If you need anything clarified, just let me know...

HTH,

C


jkiehle
13 posts
msg #33171
Ignore jkiehle
9/7/2004 11:03:20 PM

Thanks for another approach as you can see from the post 9/6/2004 1:15:34 PM. I eventually rewrote it also. Your code helped me with another one I've been working on as I had been having trouble with the count function and I wasn't aware of the sum function. I have had a really hard time finding documentation on all of the available functions and commands.

Jonathan


yepher
353 posts
msg #33172
Ignore yepher
9/7/2004 11:35:56 PM

jkiehle,

You wrote:
> I have had a really hard time finding documentation on all of the available functions and commands.


You might have a look here for a list of all commands I am aware of in Stockfetcher: http://yepher.com/~yepher/stockfetcher/command.html


kgriffen
49 posts
msg #33174
Ignore kgriffen
9/8/2004 3:12:46 AM

How about using Average True Range to get the range down? Like:
show stocks where ATR(30) is less than .75
and ATR(30) is greater than .50

Just a thought, I use it a many filters, but mostly to figure out where to put my stops.

-kg


StockFetcher Forums · General Discussion · Intraday Trades<< 1 2 3 >>Post Follow-up

*** Disclaimer *** StockFetcher.com 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. StockFetcher.com does not recommend particular securities. StockFetcher.com, 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 2016 - 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