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.

stochastic divergence scan anyone?

Anyone suggest a scan for stochastic divergence (bullish or bearish)?

Answers

  • Here's a place to start:

    https://support.stockcharts.com/doku.php?id=scans:advanced_scan_syntax:divergence_scans

    You would want price hitting a max or min, and Slow/Full Stoch %K NOT hitting a max or min (less than max, more than min), or %K hitting a min or max when price is doing the opposite.

    You would probably have to play with the parameters for max/min and %K to see what works.

    Here's a link to some other common scans:

    https://support.stockcharts.com/doku.php?id=scans:library:published_scans
  • When looking for scans, StockCharts has a lot of suggested scans in their documentation. If you use the Search function on that site, and on this site, a lot of the topics covered are at your disposal.
  • Thanks for your suggestions. Have been thru all the resources and there are remarkably few stochastic examples of scan code that I can find. For a bullish divergence, if I want price at lowest over last 20 days and stochastic not at lowest over 20 days, I thought this might work:
    //P 20d low
    AND [close< yesterday's min(20,close)]
    //Stoch not at 20d low
    AND [Daily Slow Stoch %K(14,3) > Yesterdays min (20,Slow Stoch %K(14,3))]

    but it just gives me lots of stocks in oversold territory with a slightly higher stochastic reading and no indications of divergence in sight.
    Am looking for a stochastic reading that is moving up from a higher low. It is finding a higher stoch low thru a scan that is proving elusive.
    I was thinking of
    //Stoch > yesterdays stoch
    //stoch > stoch over last 5 days
    //stoch low over prior 5 days > stoch low over prior 5-15 days
    But struggling to code this. Grateful for any further suggestions.
  • markdmarkd mod
    edited September 2019
    [group is sp500]
    and [close = max(63, close)]
    and [Slow Stoch %K(14,3) < max(63, Slow Stoch %K(14,3))]

    [group is sp500]
    and [close = min(63, close)]
    and [Slow Stoch %K(14,3) > min(63, Slow Stoch %K(14,3))]

    These scans pick up "bearish" and "bullish" divergences looking back over the last three months.

    Run these with a back date to, say, August 5 (select Aug 5 from the calendar tool) to see how they work out. A lot of them don't, which is typical. After you review the differences between those that work and those that don't, you can try to refine the scan if you find common elements in the successful charts. You could look for "confirmation" in other indicators - maybe something volume based, like OBV or Force or CMF showing accumulation or distribution, or maybe something showing the direction of the trend, like prices above a rising long term MA, or something showing appropriate relative strength (rising - bullish, falling -bearish) like Price-Performance of $SYMBOL:$INDUSTRY

    Generally, divergences are a pretty weak signal unless they confirm the trend. So a bearish divergence in a strong up trend probably won't work out unless there is other evidence of seller strength and buyer weakness. But a bullish divergence, say after a ranging period in a good up trend, might work out pretty well.

    You can also change the look back period from 63 (three months) to some other number to see if that helps. But generally, you have to account for the amount of time it takes for a divergence to develop. Unfortunately, that varies a lot from stock to stock and market to market, so there will never be a "perfect" scan.
Sign In or Register to comment.