c1916 77 posts msg #125609 - Ignore c1916 |
10/16/2015 10:46:12 AM
I'm trying to write a simple fetcher to monitor MACD momentum on my current holdings. I would expect it to look something like this:
apply to watchlist(MASTER)
and MACD Fast Line(12,26,9) crossed below MACD Slow Line(12,26,9) within the last 3 days
or MACD Fast Line(12,26,9) is below 0
or MACD Histogram(12,26,9) is below 0
However, it does not appear that "or" is allowed as an operand, as when I run this query, the first operation has holdings that meet the criteria, but operation 2 and 3 do not, yet the entire query returns null set. I've reviewed the user guide, and there is time spent on the use of "and" (page 5), but I see nothing about "or"
Am I down the wrong path here?
|
SAFeTRADE 644 posts msg #125616 - Ignore SAFeTRADE |
10/16/2015 12:20:49 PM
set{a, count(MACD Fast Line(12,26,9) crossed below MACD Slow Line(12,26,9) within the last 3 days,1)}
set{b, count(MACD Fast Line(12,26,9) is below 0,1)}
set{c,count(MACD Histogram(12,26,9) is below 0,1)}
set{d, a+b}
set{e,c+d}
add column e{signal}
s&p 500
draw MACD Fast Line(12,26,9)
draw e
|
c1916 77 posts msg #125621 - Ignore c1916 |
10/16/2015 4:13:53 PM
Clearly I have a lot more coding study in my future. The fact that the last time I coded professionally, it was in COBOL, and was probably 1985 also makes me feel silly.
Thanks for the quick response.
|
sshymko 9 posts msg #125623 - Ignore sshymko modified |
10/16/2015 7:19:58 PM
Indeed, there's a way to express the OR condition in the filters. However, it greatly complicates and obscures an otherwise natural and descriptive filtering language.
Given how common OR conditions are (the topic have been brought up on the forum over and over gain), would be great to extend the language itself rather than suggest the workaround. Internally it can be implemented as count(), summation, and comparison operators. But end users would greatly appreciate the high-level OR syntax.
Thanks in advance.
|