Code to scan for a positive slope for the 26 week price EMA

I have tried a few things but cant seem to get it right. I tried the Slope command on EMA and it isn't putting out accurate scans. I am getting instances when today's 26 week price EMA is < yesterday's 26 week price EMA. Please help and thanks in advance.

Best Answers

  • gord
    gord admin
    edited March 2015 Answer ✓
    Could you post the scan coding you are having problems with and someone will take a look at it.

    I assume you are using a Slope period of 2 as you are just comparing this week to last week.

    and [weekly Slope(2, weekly EMA(26, close)) > 0]


  • markd
    markd mod
    edited March 2015 Answer ✓
    How about:

    and [ ema(26, weekly close) = max(5, ema(26, weekly close))]

    So this says, find all stocks where the ema 26 is the highest it has been in 5 weeks. That doesn't allow any wiggle room to include rising emas that have turned down this week.

    Edit the 5 in max(5, ...) to narrow/expand the types of situations you get. If you keep the number small, you can get situations where the ema is coming off a low. If you lengthen it, you will get longer trends (although they could be wavy).

Answers

  • Thanks to gord and markd. You answered the question and provided a description of the output. Your appreciated.