50 SMA crossed 200 SMA in last 40 bars

Hi, I need help with this scan. How do I scan stocks where 50 SMA crossed up 200 SMA within last 40 bars (it could be yesterday or last month). Please help. Thanks

Best Answer

  • markd
    markd mod
    edited May 2017 Answer ✓
    You would test for the 40 days ago 50 MA less than the 40 days ago 200 MA, and today's 50 MA greater than today's 200 MA. If you get a hit, then at some point in between, the 50 must have crossed above the 200 at least once.