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.

Scan Confusion

I was writing a scan to compare absolute values of daily lows and highs. I wrote this scan and clicked on check syntax....and it came back with YOUR SCAN SYNTAX IS CORRECT ! How can this occur with one less right hand bracket in the third line vrs the second line ? Enter the statements below as a scan and see for yourself.

[type = stock] AND [Daily SMA(20,Daily Volume) >200000]
and [[AbsVal(high)- AbsVal(low)]< [AbsVal(1 day ago high)- AbsVal(1 day ago low)]]
and [[AbsVal(high)- AbsVal(low)]< [AbsVal(2 day ago high)- AbsVal(2 day ago low)]

Any thoughts ?




  • markdmarkd mod
    edited July 2018
    I get a syntax error for mismatched square brackets. I don't know why you would have gotten an 'ok' message. It's possible you "mis-clicked" somehow (e.g. the cursor wasn't where you thought it was, or you left-clicked instead of right-clicked, or...) so you didn't actually send the revision and the 'ok' message was left over from the previous successful check because the screen didn't refresh. But, I'm just guessing.

    I do have a question about the scan, however.

    Your parameters inside your absval function - high, low, 1 day ago high, 1 day ago low - are all positive numbers, so the absval function is unnecessary.

    Maybe you were thinking of:

    and [absval(high - low) < absval( 1 day ago high - 1 day ago low)]

    but, high - low will always be a positive number also (or sometimes 0), so absval is not necessary there either.

    I think what you want is:

    and [range < 1 day ago range]
    and [range < 2 days ago range]

    or, you could also write

    and [range = min(3, range)]

    although that is slightly different, in that two - or all three - values could be equal and the most recent would still be the min 3.

Sign In or Register to comment.