StockFetcher Forums · General Discussion · OR condition<< >>Post Follow-up
drago9955
6 posts
msg #104282
Ignore drago9955
1/8/2012 5:54:19 AM

Hi,

Good Day.

I wonder if there is a way to do a "OR" condition.

eg.
Close gained more than 10% over the past 5 days
or Close gained more than 15% over the past 10 days

The above scan is obviously not working in the right direction.

Does a "or" exist in the stockfetcher's syntax ?

Is there other way to get the "or" function ?

Thank You.

:)
Francis

Kevin_in_GA
4,599 posts
msg #104283
Ignore Kevin_in_GA
1/8/2012 8:27:07 AM

I wonder if there is a way to do a "OR" condition.

eg.
Close gained more than 10% over the past 5 days
or Close gained more than 15% over the past 10 days

The above scan is obviously not working in the right direction.

Does a "or" exist in the stockfetcher's syntax ?
+++++++++++++++++++++++++++

Yes, this can be done but it needs to be done more "mathematically". By the way, please search the forums before posting this, as this has been asked over and over and over.

It requires that each criterion be set as a separate user-defined variable and then used within the "count function" -

Fetcher[

set{10pct, count(Close gained more than 10% over the past 5 days,1)}
set{15pct, count(Close gained more than 15% over the past 10 days,1)}
set{combine, 10pct + 15pct}

combine above 0.5
]



By counting each time the stock meets a specific criteria, then summing those counts, the result (combine) will have a value of 1 if any of them are met.

If all of them must be met, use the same trick but MULTIPLY them instead of adding.

maxreturn
745 posts
msg #104284
Ignore maxreturn
1/8/2012 8:31:24 AM

Check out this link

http://www.stockfetcher.com/stockdb/fetcher?p=forum&sub=view&fid=1001&tid=28017

TheRumpledOne
6,411 posts
msg #104288
Ignore TheRumpledOne
1/8/2012 8:42:31 PM

I posted this years ago..

I have implemented OR, NOT and AND using SF set and count functions. Now we have a complete logic system within SF. THERE IS NOTHING YOU CAN'T DO NOW!
This should revolutionize SF Filter writing.

Fetcher[/* 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
]



Fetcher[
/* NOT Implementation */
/* by definition NOT A is TRUE IF A is FALSE*/
/* THEREFORE by counting and adding, if the sum is equal to 0 the NOT condition is TRUE. */
/* Copyright 2003 by Avery T. Horton, Jr. */
/* Permission to use NOT Implementation withing StockFetcher Granted */
/* Permission to publish or post on any other forum DENIED */
/* ----------------------------------------------------------------*/
set{NOT, count(close below 100, 1)}
show stocks where NOT equal 0
]



Fetcher[
/* AND Implementation */
/* by definition A AND B is TRUE IF A is TRUE and B is TRUE*/
/* THEREFORE by counting and adding, if the sum is equal to 2 the AND condition is TRUE. */
/* Copyright 2003 by Avery T. Horton, Jr. */
/* Permission to use NOT 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 1000000, 1)}
set{X, A + B} show stocks where X equal 2
]



Ok, first, before you BLAST me with "SF already has AND", just sit back, relax and OPEN you mind...

Using these functions, you have a complete logic system. You can implement a complete SET THEORY.

OR is greater than 0
AND is equal 2
NOT is equal 0

So by putting each condition you are filtering in a COUNT and then using SET to sum the condition pair, you can test for the OR, AND or NOT condition.

If you don't understand LOGIC or SET THEORY, I suggest you do a www.google.com search.

Those who understand will see the simple elegance of this.

GOOD LUCK WITH YOUR FILTERS!






drago9955
6 posts
msg #104322
Ignore drago9955
1/9/2012 10:35:29 PM

Hi,

Thank guys !

Thank you all very much for the replies.

I will go thro' them and hope that I can understand.

:)
Francis




StockFetcher Forums · General Discussion · OR condition<< >>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 2022 - 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


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.