MACD/RSI divergence

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #15796 quote
    ullle73
    Participant
    Senior

    Hi!

    Im wondering if anyone could code a macd or rsi divergence on the lines? I downloaded the one nicolas did on the zerolag. But it i would want the divergence on the lines and not the macd.

    #15896 quote
    Nicolas
    Keymaster
    Master

    >> Please update your country flag in your profile. Thank you 🙂 <<

    Not possible with version 10.2, but It would be something possible with the new graphical possibilities of the version 10.3 of prorealtime.
    #81490 quote
    ullle73
    Participant
    Senior
    >> Please update your country flag in your profile. Thank you 🙂 << Not possible with version 10.2, but It would be something possible with the new graphical possibilities of the version 10.3 of prorealtime.
    would this be possible now nicolas? Would you be able to help me with it? 🙂
    #81514 quote
    Nicolas
    Keymaster
    Master
    Sure, would you point me in the right direction and with the code/indicator you are mentioning?
    #81561 quote
    Meta Signals Pro
    Participant
    Veteran
    If I understood right, this will please you 😉  
    Hi Nicolas?
    There is a problem though when I use it in weekly; there is a slipage of the line rightwise that I compensated, but I do not really understand why this happens; do you have any clue?
    #81586 quote
    ullle73
    Participant
    Senior
    Sure, would you point me in the right direction and with the code/indicator you are mentioning?
    Ofc, macd lines, not histogram, see pic below.
    swapping thanked this post
    #81654 quote
    Nicolas
    Keymaster
    Master
    Ok, I changed the original MACD ZeroLag divergence indicator to add lines that identified the 2 tops or bottoms that create that divergences.
    // 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= -2
    //drawtext("0",barindex,y,dialog,bold,22)
    drawarrowdown(barindex,y) coloured(255,0,0)
    
    for i = 1 to 100 do 
    if(sto1b[i]<>sto1b[i+1]) then 
    //drawtext("0",barindex[i],y[i],dialog,bold,22) coloured(255,0,0)
    drawsegment(barindex[i],y[i],barindex,y) coloured(255,0,0)
    break
    endif
    next
    
    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= 2
    drawarrowup(barindex,y) coloured(0,255,0)
    
    for i = 1 to 100 do
    if(sto1h[i]<>sto1h[i+1]) then
    drawsegment(barindex[i],y[i],barindex,y) coloured(0,255,0)
    break
    endif
    next
    
    else
    //signH= 0
    endif
    
    ////////////////////////////////////////////////
    RETURN x coloured by x style(histogram,1) as "MACD", y  style(line,2) as "MACD signal line"//,signH as "Bullish MACD Divergence", signB as "Bearish MACD Divergence" , 0 as " zero "
    swapping thanked this post
    #81689 quote
    ullle73
    Participant
    Senior
    absolutely perfect Nicolas!! big thank you! One last thing, could you also make a screener out of this? a bullish screener
    #81731 quote
    Nicolas
    Keymaster
    Master
    You’ll find a screener made of this MACD zerolag indicator in this thread: Screener Divergence MACD
    ullle73 thanked this post
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

MACD/RSI divergence


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
ullle73 @jonas_rydqvist Participant
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by Nicolas
7 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/31/2016
Status: Active
Attachments: 6 files
Logo Logo
Loading...