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 slope over multiple time periods in one single scan

Hi I am wondering if someone can tell me if it is possible to create a one scan that would scan for multiple time periods. The best way is to past an example.

[type = stock] and [country = us] and [daily sma(1,daily volume) > 20000]
AND [Daily EMA(13,Daily Close) > 90 days ago Daily EMA(13,Daily Close) * 1.18]


ok so that would be the scan. However I would like to add other time periods in the same scan without creating multiple scans.
for example adding in this

AND [Daily EMA(13,Daily Close) > 30 days ago Daily EMA(13,Daily Close) * 1.18]

is it possible to add in these multiple time frames and the scan engine will pick up all the time frames I add?
Thank you

Comments

  • I just looked at this and it is worded wrong because I don't want it to pick up only these criteria as a whole so I would like it to be more or an or statement so the scan engine picks up all results from those criteria and not only stocks that would cover all of those statements, if that makes sense.
  • so when i put that into the scan engine as And statements it seems to work and I don't get many results but when i put that in as or statements the results are to high and the engine is not picking up the criteria properly.
  • markdmarkd mod
    edited March 2018
    I'm pretty sure the scan engine is doing what you are telling it to do, but what you are telling it to do is not what you think you are telling it to do.


    "OR" statements are tricky, especially when combined with "AND" statements. Here's one place where "or" statements are explained.

    http://stockcharts.com/docs/doku.php?id=scans:advanced_scan_syntax

    It may be that the scan IS doing what you think it's doing but there are just a lot of results that fit your conditions. If that's the case, you may have to decide what kind of stocks you want to trade. Then use the "Ticker Properties" drop down to describe those stocks - e.g. by market cap, by sector or industry, by index, by dividend, etc. or maybe by minimum/maximum volume or price.


    If you like, post your scan here and we'll see what might be done.




  • Thanks Mark here is the scan. Please let me know what you think.

    [type = stock] and [country = us] and [daily sma(1,daily volume) > 90000]
    and [RSI(14) > 50.0] and [RSI(14) < 85.0]
    and [daily sma(1,daily close) < 85.30] and [daily sma(1,daily close) > .30]
    and [group is not etf]
    and [name not contains 'fund']
    and [name not contains 'trust']
    and [name not contains 'bond']
    and [outstanding shares < 110]
    and [today's daily EMA(20) <= today's close]
    and [today's daily EMA(13) <= today's close]
    and [Daily EMa(3, Daily Close) > 10 days ago Daily Ema(3, Daily Close) * 1.06]
    or [Daily EMa(3, Daily Close) > 30 days ago Daily Ema(3, Daily Close) * 1.10
    or [Daily EMa(3, Daily Close) > 60 days ago Daily Ema(3, Daily Close) * 1.10]]
    or[Daily EMa(3, Daily Close) > 90 days ago Daily Ema(3, Daily Close) * 1.10]
    and [PctChange(1, daily close) > 2]
  • markdmarkd mod
    edited March 2018
    // First, put all the ticker properties together at the top of the scan

    [type = stock] and [country = us]
    and [group is not etf]
    and [name not contains 'fund']
    and [name not contains 'trust']
    and [name not contains 'bond']
    and [outstanding shares < 110]

    // then price and volume requirements
    and [daily sma(1,daily volume) > 90000]
    and [daily sma(1,daily close) < 85.30] and [daily sma(1,daily close) > .30]
    and [PctChange(1, daily close) > 2]

    // then indicator requirements
    and [RSI(14) > 50.0] and [RSI(14) < 85.0]

    // then overlay requirements

    and [today's daily EMA(20) <= today's close]
    and [today's daily EMA(13) <= today's close]


    // I think you want any one (or more) of these conditions to be true,
    // so to group them together and isolate them from your "and" statements
    // use an "or" statement in the form "and [ [ ] or [ ] or [ ] or etc. ]"

    and

    [ // opening "or" bracket

    [Daily EMa(3, Daily Close) > 10 days ago Daily Ema(3, Daily Close) * 1.06]

    or

    [Daily EMa(3, Daily Close) > 30 days ago Daily Ema(3, Daily Close) * 1.10]

    or

    [Daily EMa(3, Daily Close) > 60 days ago Daily Ema(3, Daily Close) * 1.10]

    or

    [Daily EMa(3, Daily Close) > 90 days ago Daily Ema(3, Daily Close) * 1.10]

    ] // closing "or" bracket


    If you want to make any of the "or" alternatives mandatory, you would move that statement outside the "or" brackets and include it in the "overlay" section.


    You can change the order of the overlays and indicators sections, but keep similar kinds of statements together. Also, it's probably better to put the simplest conditions first , so that when you get to the complex stuff (like the "or" statement) the scan engine will be operating on fewer symbols. The scan syntax doesn't require this, but it's good style to do so because it helps you keep things straight, especially when your scans get complex.
Sign In or Register to comment.