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 for MACD crossover with RSI

Hi,

I am looking to scan for stocks crossing over or about to crossover on the MONTHLY MACD above 0 and their monthly RSI above a certain level. Thank you for your help.

Comments

  • This is a basic script that will get you started.

    [type = stock] AND [group is SP500] and
    [last month's monthly MACD Line (12,26,9) < 0] and
    [monthly MACD Line (12,26,9) > 0] and
    [monthly RSI(14) > 20]
  • Hi ekwong,

    I meant to say that the monthly MACD cross over meaning that the MACD Line crossing over the MACD signal line takes place above zero on the Monthly chart. Is it possible to scan that condition?
  • Do you mean Line crosses from below to ABOVE Signal, when Signal is above 0, or, Line crosses from above to BELOW Signal, when signal is above 0?

    If you have trouble describing a condition precisely (and that can be challenging if you aren't used to doing it with something new like this), maybe you could upload a chart showing the situation you want to capture.
  • I just meant to say that the MACD crossover takes place above zero on the monthly chart.
  • OK-

    [type = stock] AND [group is SP500] and
    [last month's monthly MACD Hist (12,26,9) < 0] and
    [monthly MACD Hist (12,26,9) > 0] and
    [monthly MACD Line (12,26,9) > 0] and
    [monthly RSI(14) > 20]
  • Shoutout to @markd, @Kevo and @gord 's good work, btw.
  • @ekwong welcome back! Thanks for the kind words. We've missed you. Hope all is well.
  • hi guys,

    thank you for your help. One bit i need help with still.

    How to I scan for crossovers between the macd line and signal that are about to take place or have taken place. and the crossover between the line and the signal line takes place above zero.

  • markdmarkd mod
    edited September 2015
    Try this:

    [group is sp500]
    // signal line is above zero
    and [PPO Signal(12,26,9) > 0.0]

    // Line is very close to Signal
    and [PPO Hist(12,26,9) < 0]
    and [PPO Hist(12,26,9) > -.5]

    // Line is rising
    and [PPO Line(12,26,9) > 2 days ago PPO Line(12,26,9)]

    Note: this uses PPO which is identical to MACD, except the scale values are uniform. MACD scale values vary, so a good Hist value would vary, too. PPO should give you more consistent results.

    Hist tells you whether Line is above Signal (positive value, Hist bar is above zero on the chart) or if Line is below Signal (negative value, Hist bar is below zero). You can change the "-.5" (that's minus point five, in case your prescription is like mine, or one half of one per cent, not minus five) to something larger or smaller and see what happens, but it has to be negative for Line to be under Signal.

    You can also vary "2 days ago" to something larger or smaller and see what happens.

    The text behind the "//" symbols is comment. When you start a line with "//", nothing on that line gets executed. The scan engine doesn't see it.

    Thanks for the image. Much easier to see what you are after.
  • Thanks mark
  • Mark,

    Is it possible to do the same scan instead scanning EMAs that are very close together?
  • markdmarkd mod
    edited September 2015
    MACD Line is the difference between two EMAs, so you could just test for MACD Line(x,y,9) < 1 and MACD Line(x,y,9) > -1, or whatever values you chose for close togetherness.

    Or you can use PPO Line. The difference is MACD will give you the actual difference in points between the two EMAs; PPO will express the difference as a percentage. Either one can work. Experiment to see which gives you better results.
  • KimberlyKimberly
    edited March 6
    Can someone please help me?

    I am looking for scan parameters / settings for the following...

    MACD Trending Up

    RSI Trending Up

    Stochastic Trending Up

    Either a reversal from a drop or a turnaround

    If you look at the WEEKLY chart for Symbol: KMI

    In October, the stock reversed course and started back up at around the $15.12 level (clearly shown on the chart)

    All three (3) indicators started following each other and the stock is now sitting around $20

    I am looking for ONE (1) fast scan to check NYSE and NASDAQ for this uptrend

    Thank you so much!!

    Best of luck to everyone!

    Kimberly
  • You need to determine what you mean by a reversal and trending up. The scan engine doesn't know (and I don't know) so you have decide specifically what values to use.

    I think basically you want to compare the current value of the indicator to two values in the past - the current value is greater than a nearer past value (so moving up), and less than a farther away past value (so it must have been falling at that time).

    So, for instance:

    and [weekly MACD Line(12,26,9) > 5 weeks ago MACD Line(12,26,9)]
    and [weekly MACD Line(12,26,9) < 10 weeks ago MACD Line(12,26,9)]
  • Thank you for your response and time!

    I am looking for a way to trigger results based on a new uptrend in MACD, RSI and STOCHASTIC

    As mentioned above, if you look at the Weekly Chart for KMI, in October of 2018, around the price level of $15.12, the stock reversed from a downward trend and all indicators starting moving up.

    I am looking to catch these stocks that are making reversals before they run.

    SO, I probably need some sort of scan that looks for a SLOW REVERSAL UP, not a spike up.

    Not sure how I would set the scan up to do this..

    I really appreciate your help and any others that can help me.

    Best of luck trading!!

    Have a wonderful day!
  • markdmarkd mod
    edited March 7
    Well, as I said, you have to decide what the right parameters are.

    But, a few things to keep in mind.

    When you are looking at an "up trend", the "new" part of the up trend has already gone by. You don't KNOW the "new" part is going to be a "new up trend" until enough time goes by for you to look at the chart and say - hey, that's an up trend.

    To see what I mean, look at KMI with an end date of December 31. That's where the up leg begins on the weekly (not October), and that's what the chart looks like where you have to decide to get in if you want to capture most of the up leg. Not so easy as it looks several weeks later.

    But, you could try something as simple as testing for a 1 week change in direction or a crossover in all three indicators. Then you have to back test to see if those simultaneous signals really indicate a new trend, or whether it's just a coincidence and that combination also happens when no new up trend follows.


    So, to pick up a bar to bar change in direction in MACD (actually MACD Hist), you would compare three bars - this week's, 1 week ago and 2 weeks ago. This captures a shorter Hist bar after a longer Hist bar, all bars below zero.

    // MACD Hists are less than zero
    // you need the next three lines because the greater than, less than conditions only work for negative numbers

    and [weekly MACD Hist(12,26,9) < 0]
    and [1 week ago weekly MACD Hist(12,26,9) < 0]
    and [2 weeks ago weekly MACD Hist(12,26,9) < 0]

    // MACD Hist changes direction (gets shorter) with weekly up close
    and [weekly MACD Hist(12,26,9) > 1 week ago MACD Hist(12,26,9)]

    // last week's MACD was lower than previous week's
    and [1 week ago weekly MACD Hist(12,26,9) < 2 weeks ago weekly MACD Hist(12,26,9)]

    Then, for Slow Stochastics, you probably just need a crossover:

    and [weekly Slow Stoch %K(14,3) x weekly Slow Stoch %D(14,3)]

    And for RSI, you would compare three consecutive values again

    and [weekly RSI(14) > 1 week ago weekly RSI(14)]
    and [1 week ago weekly RSI(14) < 2 weeks ago weekly RSI(14)]

    Back test on many different past dates - from a few months ago to a year or more - to see what happens.

    Note: the charts you get from the scan will all display in your default style. You may have to adjust it to see your scan date and the following price action.



  • Thank you so much for your time and post!

    I ran the scan, for some strange reason, it mostly found ProShares

    Out of 31... it found one (1) stock and one (1) real estate trust traded stock

    One of the stocks it found was CARB

    This does look similar to the chart of KMI...

    I am trying to figure out why the scan did not find any stocks besides CARB

    Is the stock market that broken..?

    I am sitting on the sidelines right now playing with different scans trying to find something good to buy but I am not jumping in unless I see uptrend's in the three (3) indicators I am looking for.

    I sincerely appreciate your post!

    FYI...I am skeptical on CARB due to the company missing earnings estimates and I do not like the P/E among other things.

    Have a wonderful weekend and best of luck with all your trades!!

    Kimberly
  • markdmarkd mod
    edited March 8
    The number of scan results will vary as the market moves. Most stocks move with the market averages and the market has been rising for two months plus, so stocks making a bottom right now will be few. If you run the scan for dates in the last week of December, first week of January, you will probably get a lot of hits.

    Also, it can be a good time to buy a stock when the news is bad but the stock stops going down.

    CARB had a big drop in November on big volume and made seriously lower prices. It had another big drop on big volume in February but made just a barely new lower price. And now it is getting good buying. So it's a possible reversal level. (P.S. what KMI and CARB have in common (on the daily chart) is a strong reversal bar after a longish decline; what's different is KMI was an industry leader in RS (KMI:$DJUSPL) despite the decline, while CARB is an industry RS laggard (CARB:$DJUSNS), so it's more of a risk).

    If you want to use technical analysis, I'm not sure it's helpful to second guess your analysis with fundamentals like P/E and earnings estimates. At lower prices, look at whether the stock is now being sold less than before and/or bought more at lower prices. Ideally, you want both. Everybody knows the fundamental news, so if they are selling less or buying more, the "smart money" probably knows something the rest of us don't - whether its inside information or just a better grasp of the company's business. TA lets the outsider "see" what the insiders are thinking before it becomes news. The trick is to have faith in your technical analysis method, and that takes testing and practice.

    One last suggestion. Add industry RS to your chart ($SYMBOL:$INDUSTRY) with a medium term MA, like 3 months (63 days, or 13 weeks). Prefer stocks making mild declines in new price up trends when the RS MA is turning up or rising and the RS line is above, but not too far above, the MA.
Sign In or Register to comment.