Quarterly scanning

I wrote a scanner that basically looks for a quarterly candle as inside candle, meaning last 1-3 months has traded within 3-6 months. The below scan should work but it still returns me stocks that are making new highs.

[type = stock] AND [Daily SMA(20,Daily Volume) > 40000] and [Open > 10.5 ] and [optionable is true]
and [
[monthly max(6, monthly high) > 1 month ago high] and [monthly max(6, monthly high) > 2 month ago high] and [monthly max(6, monthly high) > 3 month ago high] and
[monthly min(6, monthly low) < 1 month ago low] and [monthly min(6, monthly low) < 2 month ago low] and [monthly min(6, monthly low) < 3 month ago low]

]

Any help would be appreciated.

Thanks.

Comments

  • Try this:

    // the 3 month max monthly high for the 3 months prior to the most recent 3 months is greater than the most recent 3 months max monthly high

    and [3 months ago monthly max(3, monthly high) > monthly max(3, monthly high)]

    // vice versa for the lows
    and [3 months ago monthly min(3, monthly low) < monthly min(3, monthly low)]


    In your scan, the phrase max(6, monthly high) allows the max high to be in the most recent months 4, 5 or 6 (counting forward from 6 months back). Also, your results might have been influenced by the syntax of phrases like "1 month ago high"; I think that should be "1 month ago monthly high"

    Also, if you run the scan as of a mid month date, like Oct 4, the current month appears to be counted as a whole month, even though it is not completed yet. You will get different (possibly more useful) results if you back date the scan to the last trading day of a month (e.g. Sep 29).

  • @markd It worked.. awesome. thanks for you help. I would have never thought of this.

    Thanks so much.