cire0015 6 posts msg #138181 - Ignore cire0015 |
9/15/2017 8:58:26 AM
I am trying to pull together a filter that uses a combination of various momentum based criteria then filtered by relative strength against major indices.
I am trying to use the following:
/* OR Implementation */
/* by definition OR is TRUE IF A is TRUE, B is TRUE, or A AND B is TRUE*/
/* THEREFORE by counting and adding, if the sum is greater than 0 the OR condition is TRUE. */
/* Copyright 2003 by Avery T. Horton, Jr. */
/* Permission to use OR Implementation withing StockFetcher Granted */
/* Permission to publish or post on any other forum DENIED */
/* ----------------------------------------------------------------*/
set{A, count(close above 100, 1)}
set{B, count(volume above 50,000,000, 1)}
set{OR1, A + B} show stocks where OR1 above 0
I have substituted as follows (filter already has sets B and C, and this is trying to pull stocks that are outperforming the following three indices):
set{D, count(Relative Strength(^DJI,45) is more than 1.25}
set{E, count(Relative Strength(^NDX,45) is more than 1.25}
set{F, count(Relative Strength(^SPX,45) is more than 1.25}
set{OR1, D + E + F} show stocks where OR1 above 0
However this seems to throw off my whole filter such that de-beugging shows nothing working.
Thoughts welcome.
Many thanks
Eric
|
Kevin_in_GA 4,599 posts msg #138183 - Ignore Kevin_in_GA |
9/15/2017 11:36:16 AM
You can only do one mathematical operation in set{} statement - you cannot add A +B + C in one set{} statement, please use two.
|
cire0015 6 posts msg #138184 - Ignore cire0015 |
9/15/2017 11:43:51 AM
Thanks very much Kevin.
So would that mean return a share if it outperformed Index A or B; or Index A or C?
I was actually hoping to run this against 10+ indices, i.e. show the stock if it outperforms any one index in a list.
Would that be possible?
Thanks
Eric
|
Kevin_in_GA 4,599 posts msg #138186 - Ignore Kevin_in_GA |
9/15/2017 12:46:00 PM
yes, but you will need 10 separate set{} statements to do this. That may be more than the current regular SF subscription will allow (since they are "nested" one within another).
|
mahkoh 1,065 posts msg #138190 - Ignore mahkoh |
9/15/2017 3:09:01 PM
set{D, count(Relative Strength(^DJI,45) is more than 1.25}
set{E, count(Relative Strength(^NDX,45) is more than 1.25}
set{F, count(Relative Strength(^SPX,45) is more than 1.25}
set{OR1, D + E}
set{OR2,OR1 + F}
OR2 above 0
|