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.
Options

Scan for 30 sma cross 100 sma over last 25 days inclusive.

Hi, I am trying to scan for all 30 sma cross 100 sma over last 25 days inclusive.
Price > 10
So far I have...

[group is etf]
And [type = stock]
AND [country = us]
AND [Volume > 800000]
And [25 days ago SMA(30,close) X SMA(100, close)]
And [SMA(20,close)> 10.00]

I find that the result is only the 25 day cross when what I'm after is all crosses up to 25
Thanks for any reply's

Best Answer

  • Options
    gordgord admin
    Answer ✓
    If you can use the EMA instead of an SMA then the following would work. It uses the MACD which calculates the difference between two EMA's, positive (greater than 0) when the first EMA is greater than the second, negative when first is less than the second. Then using the Min / Max over the last 25 days to find stocks which have been both below and above zero.

    [group is etf]
    And [type = stock]
    AND [country = us]
    AND [Volume > 800000]
    And [EMA(20,close) > 10.00]
    and [Min (25, MACD Line(30,100,9) ) < 0 ]
    and [Max (25, MACD Line(30,100,9) ) > 0 ]

    The above will find both stocks that have a positive and negative crossovers. If you only want the positive crosses just add the following to ensure that EMA30 is currently above EMA100.

    And [EMA(30,close) > EMA(100,close)]

Answers

  • Options
    markdmarkd mod
    edited May 2015
    It's probably possible to code a scan for that, but it would be a bear.

    It would be a lot easier to code for the crossover today, then adjust the scan date.

    I know you have to run the scan 25 times, but that would be a lot faster than coding it.

    The scan engine is really only meant to find conditions that are true today, not any day or multiple days, but the scan date adjuster tool does let you look at past days. See Gord's answer here for details on using it.


    scan.stockcharts.com/discussion/477/changing-date-on-scanner-in-order-to-backtest#latest
  • Options
    Thanks for all reply's especially yours gord. That was what I was looking for....
Sign In or Register to comment.