Screener Divergence MACD

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #55321 quote
    Talero125
    Participant
    New

    Hello!!! Thank you Nicolas for your incredible Macd divergence indicator https://www.prorealcode.com/prorealtime-indicators/macd-divergences-from-price/ I would like to use this indicator as a screener to find companies with a divergence in last days/weeks but I don´t know to change the code. Can you help me please? Thank you 

    #55327 quote
    Nicolas
    Keymaster
    Master

    Please find below the MACD divergence indicator converted to screener code: 

    // DIVERGENCES ZeroLag MACD adapted from HK-LISSE RSI divergences code
    
    //MACD periods
    short = 12
    long = 26
    signal = 9
    //-----------
    
    EMAshort1 = exponentialaverage[short](close)
    EMAshort2 = exponentialaverage[short](EMAshort1)
    DifferenceShort = EMAshort1 - EMAshort2
    ZeroLagShort = EMAshort1 + DifferenceShort
    
    EMAlong1 = exponentialaverage[long](close)
    EMAlong2 = exponentialaverage[long](EMAlong1)
    DifferenceLong = EMAlong1 - EMAlong2
    ZeroLagLong = EMAlong1 + DifferenceLong
    
    ZeroLagMACD = ZeroLagShort - ZeroLagLong
    
    signal1=ExponentialAverage[signal](ZEROLAGMACD)
    signal2=ExponentialAverage[signal](signal1)
    DIFFERENCE2=signal1-signal2
    
    SignalMACD=signal1+DIFFERENCE2
    x = ZeroLagMACD
    y = SignalMACD
    
    //  BEARISH DIVERGENCES MACD
    
    hi=max(hi,x)
    hico=max(hico,max(high,high[1]))
    
    if x crosses under y then
    sto2b=sto1b
    sto1b=hi
    hi=0
    p3b=p1b
    p2b=max(p1b,hico1)
    p1b=max(highest[3](high),hico)
    if p2b=p1b then
    p2b=max(p3b,p4b)
    endif
    hico=0
    hico1=0
    endif
    if x<y then
    p4b=hico1
    hico1=max(hico1,high)
    endif
    if p1b>p2b and sto1b<sto2b and x crosses under y and x<x[1] then
    signB= 1
    else
    signB= 0
    endif
    
    // BULLISH MACD DIVERGENCES
    
    lo=min(lo,x)
    lowco=min(lowco,min(low,low[1]))
    
    if x CROSSES OVER y  then
    sto2h=sto1h
    sto1h=lo
    lo=100
    p3h=p1h
    p2h=min(p1h,lowco1)
    p1h=min(lowest[3](low),lowco)
    if p2h=p1h then
    p2h=min(p3h,p4h)
    endif
    lowco=100000
    lowco1=100000
    endif
    if x>y then
    p4h=lowco1
    lowco1=min(lowco1,low)
    endif
    if p1h<p2h and sto1h > sto2h and x crosses over y and x>x[1]  then
    signH= 1
    else
    signH= 0
    endif
    
    ////////////////////////////////////////////////
    SCREENER [(signB or signH)]

     

    Esprityin and Arul143 thanked this post
    #64834 quote
    Esprityin
    Participant
    New
    Merci Nicolas pour ce screener… très utile dès ce soir. 🙂 J’avoue que je suis loin d’être bilingue et je suis un peu perdue dans cette masse d’infos et de mises à jour. Je suis créatrice mais pas en screener 😉 hélas. Sauriez-vous s’il existe dans la base de données de proréalcode, un screener qui détecte la MACD qui revient doucement sur son signal (comme une vague) et qui repart à la hausse et cela tout en restant proche de sa ligne 0. Merci pour votre réponse. Cdlt. Voici un exemple. [attachment file=64835]
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Screener Divergence MACD


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Talero125 @talero125 Participant
Summary

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

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 12/11/2017
Status: Active
Attachments: 2 files
Logo Logo
Loading...