Screener for Stochastic MACD Oscillator

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #140135 quote
    mscharstrom
    Participant
    Junior

    Hi,

    I have stumpled upon this https://www.prorealcode.com/topic/stochastic-macd-oscillator/ beautiful indicator which I really like.

    The code goes as follow:

    LookBack = 20
    LL       = lowest[LookBack](low)
    HH       = highest[LookBack](high)
    StEMA12  = (Average[12,1](close) - LL) / (HH - LL)
    StEMA26  = (Average[26,1](close) - LL) / (HH - LL)
    StMACD   = (StEMA12 - StEMA26) * 100
    SigLine  = Average[9,1](StMACD)
    RETURN StEMA12 AS "Ema12",StEMA26 AS "Ema26",StMACD AS "Macd",SigLine AS "Signal",0 AS "Zero"

    I am currently trying to write a Screener to find stocks that have been below -10 (or potentially -15) the latest XX periods on Daily TF.  The screener should identify/find stocks that have had a positive cross as StMACD crosses over SigLine with the criteria displayed as the difference in value between them (which I think will be the most suitable?). But coming from a low value as stated earlier (-10 or -15).

    This screener should hopefully help to find new price trends that might come in to play from an oversold state. By being able to increase the lookback period to lets say “45” it would make it easier to see the new price trend that has been formed and manually draw out the trend lines (maybe combining it fibonacci to find good entry levels).

     

    One option could be to have both +10 and -10 as criteria with 1 and 2 to display the stocks as Overbought or oversold.

     

    I’m a novice in coding Java and frankly, im a bit lost. I tried different things but I believe adding my code to the forum will not only make me look stupid, but also confuse other members.

    I have searched to forum but to no success in finding a screener for this.

     

    Hope to hear from anyone more experienced soon :).

    #140311 quote
    mscharstrom
    Participant
    Junior

    Sorry, I forgot to mention that I am using PRT 10.3.

    #140316 quote
    robertogozzi
    Moderator
    Master

    There you go (I only tested syntax):

    LookBack = 20
    LL       = lowest[LookBack](low)
    HH       = highest[LookBack](high)
    StEMA12  = (Average[12,1](close) - LL) / (HH - LL)
    StEMA26  = (Average[26,1](close) - LL) / (HH - LL)
    StMACD   = (StEMA12 - StEMA26) * 100
    SigLine  = Average[9,1](StMACD)
    //
    //RETURN StEMA12 AS "Ema12",StEMA26 AS "Ema26",StMACD AS "Macd",SigLine AS "Signal",0 AS "Zero"
    MaxBars  = 20
    c1      = StMACD < -10
    c2      = summation[MaxBars](c1) > 0
    c3      = StMACD CROSSES OVER  SigLine
    cCond   = c2 AND c3
    //
    d1      = StMACD > 10
    d2      = summation[MaxBars](d1) > 0
    d3      = StMACD CROSSES UNDER SigLine
    dCond   = d2 AND d3
    //
    Result  = 0
    IF cCond THEN
       Result = 1
    ELSIF dCond THEN
       Result = 2
    ENDIF
    SCREENER[Result](StMACD AS "StMACD")
    #140516 quote
    mscharstrom
    Participant
    Junior

    Many thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Screener for Stochastic MACD Oscillator


ProScreener: Market Scanners & Detection

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by mscharstrom
5 years, 7 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 07/26/2020
Status: Active
Attachments: No files
Logo Logo
Loading...