Calculation of a TP trough RSI Divergence

Viewing 15 posts - 1 through 15 (of 27 total)
  • Author
    Posts
  • #154753 quote
    Zigo
    Participant
    Master

    I note that in most cases, and speaking of more than 75%, of cases, the calculated Target price (TP) is met. The chart shows both the purchase price and the TP. A green rectangle, for upward rates and a red rectangle for downward rates, indicates the 2 candles where the divergence ends. The TP (line) is printed in the graph, green for upward calculation and orange for downward calculation.

    Depending on the timeframe, purchased (OB) and sold (OS) are adjusted. The period for the RSI is usually 11 and not 14. The variables are for period (n) for overbought (OB) and for over sold (OS). If someone feels called to test these kinds of parameters in a backtest. In that case, I would kindly like to know the results.

    PXI-322-ticksDiv.png PXI-322-ticksDiv.png
    #154755 quote
    Zigo
    Participant
    Master
    See attachment for the opposite direction.
    PXI-144-secondenDiv.png PXI-144-secondenDiv.png
    #154757 quote
    Zigo
    Participant
    Master
    The coding for RSI TP is based on a lookback period of 29 (see line 53 and 73), if you change this value, for example to the first top (bottom) the calculation becomes different so as the results. Maybe if backtest there would be a variable number instead of 29 it could be optimised. Here is the coding:
    // --- settings
    //Zigo 21/12/2020
    RSIp=n //RSI period
    once obLevel=ob //overbought level
    once osLevel=os //oversold level
    minimalBars=5 //minimal count of bars where RSI is ob or os
    // --- end of settings
     
    
    
    irsi = rsi[RSIp]
    ob = irsi>obLevel
    os = irsi<osLevel
     
    if ob then
    if not ob[1] then
    maxrsi = 0
    maxprice = 0
    firstobbar = barindex
    
    endif
    maxrsi=max(maxrsi,irsi)
    maxprice=max(maxprice,high)
    if maxrsi<>maxrsi[1] then
    maxrsibar=barindex
    endif
    endif
     
    if os then
    if not os[1] then
    minrsi = 100
    minprice = close*100
    firstosbar = barindex
    endif
    minrsi=min(minrsi,irsi)
    minprice=min(minprice,low)
    if minrsi<>minrsi[1] then
    minrsibar=barindex
    endif
    endif
     
    Once divsell=0
    
    if irsi crosses under obLevel then
    //verif divergence
    div = maxprice>oldmaxprice and maxrsi<oldmaxrsi and (barindex-firstobbar)>=minimalBars
    if div then
    s=(High[0]+low[0])/2
    drawsegment(oldmaxrsibar,oldmaxRSI,maxrsibar,maxRSI) coloured(255,255,0, 255)
    DRAWRECTANGLE(barindex, low-AverageTrueRange[14](close), barindex[1], low[1]-3*AverageTrueRange[14](close))coloured(255,55,25,255)
    DRAWTEXT("Start Div RSI Down", barindex, High+2.5*AverageTrueRange[14](close),dialog, standard, 15)coloured(205,170,120,255)
    DRAWTEXT("Enter Short = #s#", barindex, High+ 1.5*AverageTrueRange[14](close),dialog, standard, 15)coloured(205,170,120,255)
    TPSh= (Lowest[29](low)+ (maxprice-oldmaxprice))
    DRAWHLINE(TPsh)coloured(255,0,0,35)
    DRAWTEXT("TargetLine = #TPSh#", barindex, TPSh-0.5*AverageTrueRange[14](close),dialog, standard, 12)coloured(205,205,0)
    divsell=s
    endif
    oldmaxrsi = maxrsi
    oldmaxprice = maxprice
    oldmaxrsibar = maxrsibar
    endif
    Once divbuy=0
    
    if irsi crosses over osLevel then
    //verif divergence
    div = minprice<oldminprice and minrsi>oldminrsi and (barindex-firstosbar)>=minimalBars
    if div then
    b=(open)
    drawsegment(oldminrsibar,oldminrsi,minrsibar,minrsi) coloured(0,200,0)
    DRAWRECTANGLE(barindex, High+AverageTrueRange[14](close), barindex[1], high[1]+4*AverageTrueRange[14](close))coloured(0,125,175,255)
    DRAWTEXT("Start Div RSI Up", barindex, Low-2*AverageTrueRange[14](close), dialog, standard,15)coloured(125,255,125,255)
    DRAWTEXT("Enter Long <= #b#", barindex, low-1.5*AverageTrueRange[14](close),dialog, standard, 15)coloured(0,255,0,255)
    TPL=(Highest[29](High)- (minprice - oldminprice))
    DRAWHLINE(TPL)coloured(0,255,0,35)
    DRAWTEXT("TargetLine = #TPL#", barindex, TPL+0.5*AverageTrueRange[14](close),dialog, standard, 12)coloured(0,255,0,255)
    divbuy=b
    endif
    oldminrsi = minrsi
    oldminprice = minprice
    oldminrsibar = minrsibar
    
    endif
     
    return
    Al and Monobrow thanked this post
    #154758 quote
    Zigo
    Participant
    Master
    Dare to use other timeframes then classical timeframes. See the difference between 30 min and 29 min.
    PXI-30-minuten.png PXI-30-minuten.png PXI-29-minuten.png PXI-29-minuten.png
    #154761 quote
    Zigo
    Participant
    Master
    The indicator can also in a separate frame.
    PLermite thanked this post
    PXI-29-minutenInd.png PXI-29-minutenInd.png
    #154973 quote
    Zigo
    Participant
    Master
    Update for the targetline. (PXI 29min.)
    PXI-29-minuten.Updatepng.png PXI-29-minuten.Updatepng.png
    #154982 quote
    Zigo
    Participant
    Master
    If the Target Line is more then a few pips the TP will not reached at ones.
    PXI-29-minutenT.png PXI-29-minutenT.png
    #155192 quote
    Zigo
    Participant
    Master

    At stagnant rates it is sometimes easier to make determinations. Today I looked at the Dow Jones on day chart and established a double “negative divergence” for the RSI (14), albeit with the OB and OS settings 60, 40.

    It is nice that the SMI (14,3,5) with OB and OS settings of 40 and -40 respectively shows a similar “negative divergence”. The CCI(18) with the OB and OS settings of 100, -100 closes, also the row with a “negative divergence”.

    The future will show whether these divergences will have an impact on the rates.

    #155193 quote
    Zigo
    Participant
    Master
    Sorry, I forgot the attachment.
    DOW-DagDiv.png DOW-DagDiv.png
    #156520 quote
    Zigo
    Participant
    Master
    Double Divergence on Dax today. Manual calculation: First TP shortest dotted lines at TP =13665.5-(13754-13730.5)=13742  (inner divergence) Second TP overlapping divergence at TP=13617-(13769.5-13719.5)=13567  (outer divergence)
    DAX-521-ticksDDiv.png DAX-521-ticksDDiv.png
    #156560 quote
    Monobrow
    Participant
    Senior
    Thanks Zigo, ive been wondering how to calculate a TP from an indicator for a while as im just using fixed values at the moment.   is the general consensus that RSI is the “best” way to do TPs?  Have you tried others?   Also for Stops I was playing with the idea of using ichimoku cloud breakouts/breakthrus, but couldnt get it to work, have you worked on any indicator based stop ideas?   thanks again. Awesome code.
    #156677 quote
    Zigo
    Participant
    Master
    @monobrow Indeed RSI is the best indicator to calculate a TP. Thanks for your reply.
    Monobrow thanked this post
    #156693 quote
    Zigo
    Participant
    Master
    TP calculated on the CCI indicator
    DAX-843-ticksDiv.png DAX-843-ticksDiv.png
    #156700 quote
    Zigo
    Participant
    Master
    Calculated by RSI
    DAX-521-ticks8u53.png DAX-521-ticks8u53.png
    #156716 quote
    Zigo
    Participant
    Master
    Almost reached.
    DAX-521-ticks9u35.png DAX-521-ticks9u35.png
Viewing 15 posts - 1 through 15 (of 27 total)
  • You must be logged in to reply to this topic.

Calculation of a TP trough RSI Divergence


General Trading: Market Analysis & Manual Trading

New Reply
Author
author-avatar
Zigo @zigo Participant
Summary

This topic contains 26 replies,
has 2 voices, and was last updated by Zigo
3 years, 8 months ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 12/21/2020
Status: Active
Attachments: 18 files
Logo Logo
Loading...