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.

MA cross within 'x' number of past days.

daredare
edited March 2015 in Scanning
I know of a scan program offered by another company that permits one to insert a condition to the effect of "and ema(7) of the close crossed above ema(21) of close within last 'x' days". Is there a way to accomplish the same in a Stockcharts scan with the same or better brevity? Actually on the other scanner it can be entered with even less verbage: "and ema(7,close) crossed above ema(21,close) withing last 'x' days."


Thanks

Best Answer

  • gordgord admin
    edited March 2015 Answer ✓
    So you are looking for the EMA-7 to be above the EMA-21 today, but somewhere in say the last 5 days it has been below the EMA-21.

    As you are looking at EMA's we could use the MACD which defines the difference between two EMA's. A positive MACD Line means EMA-7 is above EMA-21, a negative number means its below.

    Thus you want greater than 0 today and less than 0 sometime in the last 5 days. The following scan will do that with just two lines of code.

    [type = Stock]
    and [MACD Line(7,21,9) > 0.0]
    and [Min (5, MACD Line(7,21,9)) < 0.0]

Answers

  • daredare
    edited March 2015
    It certainly does Gord and I thank you. I should have thought of it as I use the PPO quite a bit to determine how far a moving average is from the close.
Sign In or Register to comment.