New Members: Be sure to confirm your email address by clicking on the link that was sent to your email inbox. You will not be able to post messages until you click that link.
Using Mathematical Expressions in Scan
Is there a way to scan for something like this:
[(OPEN - CLOSE) <= (HIGH-LOW)*1.5]
or scan for absolute value like:
ABS(Open-Close)<=(High-Low)
0
Answers
You also need brackets to enclose the entire statement
and [... ]
so you will have sets of brackets for expressions inside brackets to enclose the entire statement.
When I write : [ABS [Open - Close] <= [High-Low]*1.5]
I get the following: Could not parse "ABS [OPEN - CLOSE]"
I tried using regular parenthesis (...) to open and close the argument, but it didn't work.
What am I missing?
This passes syntax:
and [absval(open - close) >0]
I'm wondering about your full statement, though.
The distance between the open and close can never be greater than the distance from high to low (in the same bar), but you seem to be asking for cases where open to close is less than an even larger distance - 1.5 x the distance from high to low.
For instance, this returns all 500 of the SP500:
[group is sp500]
and [absval(open - close) <= [high - low] * 1.5]
Are you looking for open to close to be some proportion of the total range?
[ABSVAL(Open - Close) <= (High-Low) * 1.5]
I modified it like this:
[ABSVAL ((Open - Close) <= (High-Low)) * 1.5]
or with brackets:
[ABSVAL [(Open - Close) <= (High-Low)] * 1.5]
Still doesn't work...
Indeed, I had the wrong brackets-parenthesis in the formula. I corrected it and it worked.
And, you are correct about "The distance between the open and close can never be greater than the distance from high to low..."
My original scan contains more data than what I asked here. I was struggling with the math data scanning, and you resolved it brilliantly! After all, I can't divulge all my little secrets on how to find the right stock at the right time!