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.

10 day Moving Averages (10 dMA) turning direction scan

As part of a broad scan I need to have an embedded scan that finds 10 dMA's turning up.

I tried building this:

[[SMA (10, close) > SMA (10, 1 days ago close)] and [SMA (10, 1 days ago close) > SMA (10, 2 days ago close)]]]

and it returned nothing.

Is here anyway to build a scan that finds moving averages as they turn up or have a positive slope over the last two or three days?

Thanks in advance,

Sam

Comments

  • markdmarkd mod
    edited April 2015
    Try this:

    In order for there to be a turn, you have to test for the 10MA being higher at some point in the past, and then lower at some closer point in the past


    and [sma(10,close) < 2 days ago sma(10,close)]
    and [sma(10, close) > 1 days ago sma(10,close)]

    Note: the terms are a little different than yours (the "days ago" precede the sma term, not inside it).

    This code catches a one day turn up, but since the MA is so short, it might not be a real turn.

    You could play with the "days ago" parameters to get what you want. Maybe 5 and 2?

    Also, since this gets alot of hits, you might want to limit the universe if you aren't already - e.g. [group is sp500] or [close > 20] and [volume > 100000] or whatever.
  • AWESOME. Thanks. It was moving the "1 days ago" to in front of the "SMA" that did the trick.

    Thank you so much

    Sam
Sign In or Register to comment.