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.

Wayne, Scan for price withing 5% of a MA

WayneWayne
edited June 2016 in Scanning
Does any one know how to create a scan that finds stocks within 5% (or any other %) of their 50 and/or 200 day simple moving average?

Best Answer

  • markdmarkd mod
    Answer ✓
    Five per cent above the average would be sma(50, close) * 1.05

    Five per cent below the average would be sma(50, close) * .95

    So you need a line that says the close is less than the number (per cent) above the average, and then a line that says the close is greater than the number (per cent) below the average.

    Does that help?

Answers

  • Awesome. Thanks much.
  • markd,

    I have this scan...

    and [Close > 2.5]
    and [Close < 20]
    AND [Daily Hammer = 1]
    and [[Close < SMA(50,close) * 1.02 ] OR [Close > SMA(50,close) * .98 ]]

    Is this correctly scanning?? Specifically the above/below the 50 sma within 2%. I am getting a few stocks that fit the parameters and others that are outside the 2%.

  • gordgord admin
    edited July 2016
    The problem is with your last clause.

    and [[Close < SMA(50,close) * 1.02 ] OR [Close > SMA(50,close) * .98 ]]

    You are asking to return any stocks with the close less than SMA50 close *1.02 so that covers all stocks down to $0. "OR" you want stocks where the close is greater than the SMA50 * 0.98 so that covers all stocks from that point up to infinity, both groups will be returned by the scan.

    What you need to do is change the "or" to an "and",, ie you want stocks that meet both criteria, above the 0.98 and below the 1.02 limit.

    give that a try
    cheers Gord

    PS it's also better to ask new questions in a new post rather than append them to the end of an old post, that way people will see them more easily, they will appear at the top of the list.
  • Ok great thanks for the heads up.
Sign In or Register to comment.