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.

Scan - looking for securities about to go bearish on weekly MACD

Hi fellow chartists,

I have drafted a scan for securities & indices that are still positive on the MACD histogram, but about to go bearish (ie the MACD hist is less than 0.5)

welcome any guidance!
Thank you


[[type = stock] and [market cap > 2000]]
OR
[type is index]
OR
[[Group is ETF] and [group is ETFNOUI]]

OR

[Exchange is CME] OR [exchange is LSE]


AND

[group is not Sp600]
AND [group is not Sp400]
AND [country is not canada]
AND [group is NOT TSE300]


and [exchange is NOT NSE]
and [exchange is NOT OTCMKT]
and [exchange is not TSE]


and [country is not Canada]



// DCR ENTER PARAMETRES NEXT


and [[weekly MACD Hist(12,26,9) > 0.0] and [weekly MACD Hist(12,26,9) <0.5]]


AND [Weekly MACD Line(12,26,9,Weekly Close) > 0]
AND [Weekly MACD Signal(12,26,9,Weekly Close) crosses Weekly MACD Line(12,26,9,Weekly Close)]
AND [Weekly MACD Hist(12,26,9,Weekly Close) < Last Week's MACD Hist(12,26,9,Weekly Close)] AND [Last Week's MACD Hist(12,26,9,Weekly Close) < 2 weeks ago Weekly MACD Hist(12,26,9,Weekly Close)] AND [2 weeks ago Weekly MACD Hist(12,26,9,Weekly Close) < 3 weeks ago Weekly MACD Hist(12,26,9,Weekly Close)] AND [3 weeks ago Weekly MACD Hist(12,26,9,Weekly Close) < 4 weeks ago Weekly MACD Hist(12,26,9,Weekly Close)]


Rank by "Marketcap"

// end universe section

Comments

  • markdmarkd mod
    edited August 2016
    A couple of comments.

    It would really help if you could put each condition (starting with "and") on a separate line, and above each line a comment about what the line is supposed to do.

    Also, I think you need to re-think your universe statements can be clearer. Instead of stating a mix of what you do and don't want, just state what you do want. Then if what you want has a subset of thinks you don't want, add conditions to exclude those.

    [group is ETF] includes ETFNOUI, so you don't need to specify EFTNOUI unless you want to exclude them, or if you want them, but not regular ETFs.

    I think it would be helpful to list just the exchanges you want and omit the ones you don't. For instance, if you say [exchange is NYSE] you will get result only for NYSE stocks, so you don't have to say [exchange is not NSE].

    Another way to approach this is to make the indicator conditions work, one at a time, on just one type of stock, say [exchange is NYSE], and then add new conditions until you get the complete scan.
  • This line ask for Hist above zero - MACD LIne (black) is above MACD Signal (Red)

    and [[weekly MACD Hist(12,26,9) > 0.0] and [weekly MACD Hist(12,26,9) <0.5]]


    But this line asks for Line (black) to cross below Signal (red)

    //AND [Weekly MACD Signal(12,26,9) x Weekly MACD Line(12,26,9)]

    If Line crosses below Signal, Hist will be below 0.

    So you will get no results.

  • Thank you Mark

    I have redrafted the scan as below taking on board your points: I have a couple of questions if you don't mind:

    1. Could I improve the order of the scan - is it logical in terms of flow and does it calculate at optimal level (some scans are slow)?

    2. In the new scan why does the "Vanguard Tele Services ETF " not appear

    3. [name does not contain "ishares"] generated an error message

    4. (Ideally I would like to rank by "Universe" column in the results, tho I gather this is still not feasible



    [[type = stock] and [market cap > 2000]] // Scan for all securities with Market Cap > $2bn

    OR

    [type is index] // include in scan all INDX

    OR

    [[Group is ETF] and [group is not ETFNOUI]] // Include in scan all ETF's but exclude leveraged (or similar) ETF's


    OR

    [Exchange is CME] // Include all securities on CME

    OR

    [[exchange is LSE] and [market cap > 100]] // Include all securities listed on LSE with a Market Cap > 1bn


    AND

    [exchange is NOT OTCMKT] // Exclude OTC

    AND

    [exchange is not TSE] // Exclude Canadian listed securities




    AND

    [Weekly MACD Signal(12,26,9,Weekly Close) crosses Weekly MACD Line(12,26,9,Weekly Close)] // scan applies where the Red signal line crosses the black MACD line

    AND
    [Weekly MACD Hist(12,26,9,Weekly Close) < Last Week's MACD Hist(12,26,9,Weekly Close)] // scan applies where this weeks MACD HIST < Last weeks Hist

    AND
    [Last Week's MACD Hist(12,26,9,Weekly Close) < 2 weeks ago Weekly MACD Hist(12,26,9,Weekly Close)] // scan applies where last weeks MACD HIST < previous weeks Hist


    AND
    [2 weeks ago Weekly MACD Hist(12,26,9,Weekly Close) < 3 weeks ago Weekly MACD Hist(12,26,9,Weekly Close)]

    AND
    [3 weeks ago Weekly MACD Hist(12,26,9,Weekly Close) < 4 weeks ago Weekly MACD Hist(12,26,9,Weekly Close)]


    Rank by "Marketcap" // Rank By Market Cap
  • You need a set of brackets around your "universe" OR statements, so they would begin:

    [ // begin universe OR statement

    [[type = stock] and [market cap > 2000]] // Scan for all securities with Market Cap > $2bn

    ....

    [group is not ETFNOUI] // Include in scan all ETF's but exclude leveraged (or similar) ETF's

    ] // end universe OR statement

    Notice I edited your ETF statement. That should be enough to exclude inverse and ultras.

    Have you gotten results from the CME exchange? It's not listed as an available exchange in the documentation. But possibly the doc is not up to date.

    For excluding ishare, my bad. It should be:

    and [name not contains "ishares"]

    For Line and Signal - do you want to say Line crosses *above* , or Line crosses *below* the Signal line (note: the black Line moves faster than the red Signal, because Signal is a moving average of Line and therefore must move more slowly).

    The "crosses" operator always means "crosses above". So the first term always crosses above the second. That means, if you want something to "cross below" something else, the thing it crosses below must be the first term.

    For instance, in a Stochastic indicator, if the want %K to cross below 20, you have to write it as 20 crosses above %K:

    and [20 x Fast Stoch %K(10,1)]

    So with Line and Signal, which is crossing above which?

    As you have it now, it says Line crosses below Signal. Is that what you want?

    If that's the case, you could also say

    and [0 x MACD Hist(12,26,9)]

    because MACD Hist is the distance between Line and Signal. When Line crosses below Signal, Hist turns negative, so 0 "crosses above" Hist.

  • Mark,

    You are a legend

    Thank you
Sign In or Register to comment.