StockFetcher Forums · General Discussion · A COMPLETE LOGIC SYSTEM - ANOTHER GIFT FROM AVERY<< 1 2 3 4 5 ... 10 >>Post Follow-up
TheRumpledOne
6,358 posts
msg #28090
Ignore TheRumpledOne
8/27/2003 1:02:40 AM

PHMD... looks good.. too bad you didn't buy in at the daily low today.
========

The filters in this thread are EXAMPLES of how to code Stockfetcher filters so you can use BOOLEAN LOGIC, "or" and "not" in particular. I included "and" so the "language" would be complete. You can now use "or" without the combination problem bringing the server to its knees.

Funny thing, I realized today that I did the exact same thing about 20 years ago in RPG II because that language did not have IF statements.

People (including myself) have requested that StockFetcher give us "or" and "not". Until SF or somebody else creates a META LANGUAGE and code generator for StockFetcher , this is a way to code the BOOLEAN LOGIC.

A FILTER WIZARD would sure be cool!! Similiar to eSignal's Formula Wizard.






TheRumpledOne
6,358 posts
msg #28170
Ignore TheRumpledOne
8/31/2003 2:17:16 AM

I am curious...

Has anyone out there used my logic technique?

Would love to see it applied.




deprez
60 posts
msg #28180
Ignore deprez
8/31/2003 4:48:59 PM

I tried but there is a problem. Please help.

Fetcher[
set{c1, pattern is bullish upside tasuki gap}
set{c2, pattern is bullish side-by-side white lines}
set{c3, pattern is bullish separating lines}
set{c4, pattern is bullish three line strike}
set{c5, pattern is bullish upside gap three methods}
set{c6, pattern is bullish harami cross}
set{c7, pattern is bullish three outside down}
set{c8, pattern is bullish three inside up}
set{c9, pattern is bullish homing pigeon}
set{c10, pattern is bullish bullish harami}
set{c11, pattern is bullish morning doji star}
set{c12, pattern is bullish tri-star}
set{c13, pattern is bullish meeting lines}
set{c14, pattern is bullish unique three rivers}
set{c15, pattern is bullish abandoned baby}
set{c16, pattern is bullish matching low}
set{c17, pattern is bullish engulfing}
set{c18, pattern is bullish concealing baby swallow}
set{c19, pattern is bullish three white soldiers}
set{c20, pattern is bullish kicking}
set{OR1, c1 + c2 }
set{OR2, OR1 + c3 }
set{OR3, OR2 + c4 }
set{OR4, OR3 + c5 }
set{OR5, OR4 + c6 }
set{OR6, OR5 + c7 }
set{OR7, OR6 + c8 }
show stocks where OR7 above 0
]




murknd
62 posts
msg #28181
Ignore murknd
8/31/2003 5:02:56 PM

deprez,

Read this - I think you're mis-using the set feature.

D

http://www.stockfetcher.com/stockdb/fetcher?p=varhelp



deprez
60 posts
msg #28206
Ignore deprez
9/1/2003 4:46:45 PM

I thought it was an "overloaded class" which would allow the plus sign to be used for addition and the "or logic". I guess I was wrong.

I tried it initially with "count" as prescribed but had zero results I will rewrite it and see if it works.


Icculi
9 posts
msg #31429
Ignore Icculi
3/16/2004 10:21:49 PM

Try this

Stock
Fetcher[
set{c1, count(pattern is bullish upside tasuki gap,1)}
set{c2, count(pattern is bullish side-by-side white lines,1)}
set{c3, count(pattern is bullish separating lines,1)}
set{c4, count(pattern is bullish three line strike,1)}
set{c5, count(pattern is bullish upside gap three methods,1)}
set{c6, count(pattern is bullish harami cross,1)}
set{c7, count(pattern is bullish three outside down,1)}
set{c8, count(pattern is bullish three inside up,1)}
set{c9, count(pattern is bullish homing pigeon,1)}
set{c10, count(pattern is bullish bullish harami,1)}
set{c11, count(pattern is bullish morning doji star,1)}
set{c12, count(pattern is bullish tri-star,1)}
set{c13, count(pattern is bullish meeting lines,1)}
set{c14, count(pattern is bullish unique three rivers,1)}
set{c15, count(pattern is bullish abandoned baby,1)}
set{c16, count(pattern is bullish matching low,1)}
set{c17, count(pattern is bullish engulfing,1)}
set{c18, count(pattern is bullish concealing baby swallow,1)}
set{c19, count(pattern is bullish three white soldiers,1)}
set{c20, count(pattern is bullish kicking,1)}
set{OR1, c1 + c2}
set{OR2, OR1 + c3}
set{OR3, OR2 + c4}
set{OR4, OR3 + c5}
set{OR5, OR4 + c6}
set{OR6, OR5 + c7}
set{OR7, OR6 + c8}
show stocks where OR7 is above 0
]





defghca
150 posts
msg #31431
Ignore defghca
3/17/2004 6:46:29 AM

An OR filter using 2 popular variation of the MUDDY filter

2. RSI(2) DAILY (Avery/HG):

RSI(2) IS BELOW 2 AND AVERAGE VOLUME(90) IS ABOVE 100000 AND PRICE IS
BETWEEN 1 AND 10 AND PRICE TOUCHED LOWER BOLLINGER BAND(20) AND CLOSE
HAS BEEN DECREASING OVER THE LAST 3 DAYS

3. LRI DAILY (Avery/HG):

60 DAY SLOPE OF THE CLOSE IS ABOVE 0 AND CLOSE NEAR BOTTOM LINEAR
REGRESSION LINE(60) AND AVERAGE VOLUME(90) IS ABOVE 100000 AND PRICE
IS BETWEEN 1 AND 10 AND PRICE TOUCHED LOWER BOLLINGER BAND(20) AND
CLOSE HAS BEEN DECREASING OVER THE LAST 3 DAYS

combining these 2 filters in a OR filter

set{A, count(RSI(2) IS BELOW 2 , 1)}
set{B, count(60 DAY SLOPE OF THE CLOSE IS ABOVE 0.5,1)}
set {C, count(CLOSE NEAR BOTTOM LINEAR REGRESSION LINE(60),1) }
set{OR0,a+b}
set{or,or0+c}
show stocks where OR is above 0 and AVERAGE VOLUME(90) IS ABOVE
100000 AND PRICE IS BETWEEN 1 AND 10 AND PRICE TOUCHED LOWER
BOLLINGER BAND(20) AND CLOSE HAS BEEN DECREASING OVER THE LAST 3
DAYS

i sure wish SF would implement the "OR" conjunction, it would be so
much simpler




TheRumpledOne
6,358 posts
msg #31437
Ignore TheRumpledOne
3/17/2004 5:40:20 PM

DEFGHCA:

Isn't it more fun BENDING a system to your will?




TheRumpledOne
6,358 posts
msg #32367
Ignore TheRumpledOne
6/16/2004 8:15:04 PM

I am happy to see people making use of this.

MAY ALL YOUR FILLS BE COMPLETE.


cegis
235 posts
msg #32374
Ignore cegis
6/17/2004 1:35:21 PM

RumpledOne,

Good idea to make a post on this thread to bring it back to the top of the list!

I just re-read the thread, and would like to make some comments:

1) RPG II - WOW! I haven't used THAT for quite a while, either! (But more recently than 20 years ago, I think. Imagine THAT!)

2) Unfortunately, I don't believe this technique is copyrightable, as it is standard algebraeic (sp??) logic, with one exception: AND is "usually" implemented with multiplication (c1 * c2 = 1 is the same as c1 AND c2). Using multiplication keeps your values 1 if "the whole schebang" is true, and 0 if false. (Think complex conditions...) No need to figure that c1 AND c2 AND c3 should be using 3 instead of 2 and so forth. (Although that's not hard, it could be a point of error if you are editing a filter.)

3) "NOT c1" could also be implemented as (1 - c1), which again keeps "true" = "1", and "flase" = "0", for use in more complicated expressions. (Again, "standard" algebraeic logic...)

4) **IMPORTANT** (IMHO) This technique also allows for IF/THEN/ELSE!!! Let me use an example (NOT necessarilly a good filter, but a good example!) to explain. Suppose you want a volume condition, but the volume limit is to be based on price. Let's say, if a stock's price is less than $5, you want an average volume(30) of at least 100,000. For stocks >= $5, you want the average volume(30) to be at least 250,000. Here's a filter that illustrates how to achieve this:

Fetcher[
set{if,count(price is less than 5,1)}
set{vol1,if * 100000}
set{else,1 - if}
set{vol2,else * 250000}
set{vol,vol1 + vol2}

price between 4.5 and 5.5
and average volume(30) is greater than vol

add column average volume(30)
add column if
add column else
add column vol1
add column vol2
add column vol
]



The first set{} will result in "if" being 1 if the price is below $5, or 0 if the price is >= $5.

The second set{} command (and here's the trick) will result in "vol1" being 100,000 if the price is below $5, or ZERO otherwise. This is kinda like an AND, except the value you're looking for won't be only zero or one.

The third set{} is really "NOT if", to be used for the "else" part of the condition.

The fourth set{} uses the same trick as the second, resulting in "vol2" being 250,000 or zero.

Note that "vol2" will be 250,000 ONLY when "vol1" is zero, and "vol1" will ONLY be 100,000 when "vol2" is zero. That allows the last set{} command to be our desired volume limit based on price! (This is kinda like an OR, except using non-binary numbers.)

Oh, yeah. This is also a case where you might NEED the implementation of AND described above, and NOT BE ABLE to use SF's implementation. (Think "volume must be > 100,000 if price is < 5 AND RSI(2) < 1, otherwise voume must be > 250,000".)

I hope this information is useful.

C


StockFetcher Forums · General Discussion · A COMPLETE LOGIC SYSTEM - ANOTHER GIFT FROM AVERY<< 1 2 3 4 5 ... 10 >>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