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.

Scanning for a flat moving average

I have been trying to find a way to scan for EMA(15) to be flat for 5 to 8 bars. Of course there would be some wiggle, but basically flat.
Is there a way to look for a flat moving average?

Comments

  • markdmarkd mod
    edited May 2015
    Try this:

    It says, the difference between the maximum and minimum value of the 15 day exponential moving average over the last 8 days is less that 1/10 of 1 per cent.


    and [PctDiff(max(8,ema(15,close)), min(8,ema(15,close))) < 0.1]

    Notice all the parentheses you have to get right- especially that there are three at the end of the PctDiff function.

    You can play with the 0.1 at the end. A whole number is a per cent - so 1.0 would be 1 per cent. I don't think you would want to go higher than that for most stocks. To go smaller, I'm not sure how many decimals you can add after the decimal point, e.g. 0.0125. Give it a try.
  • That is exactly what I needed, works as presented. Thanks much.
Sign In or Register to comment.