Traducción de indicador :"CDC RSI Divergence"a PRT

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #68043 quote
    Fr7
    Participant
    Master

    Hola Nicolás, he encontrado este indicador basado en divergencias del indicador RSI.¿Podría traducirlo?GRACIAS

    //@version=2
    study(“CDC RSI Divergence”, shorttitle=”CDC_RSIDV”)

    // SETTING UP VARIABLES //

    src = input(title=”Data Source”,type=source,defval=ohlc4)

    // look back periods //
    x = input(title = “short lookback period”,type=integer,defval=5)
    z = input(title = “long lookback period”,type=integer,defval=25)
    revpct = input(title=”Reversal Percentage”,type=float,defval=0.01)/100
    alert = input(title=”Alert period”, type=integer, defval=25)

    // RSI //
    rsiprd = input(title=”RSI period”,type=integer,defval=14)
    rv = rsi(src,rsiprd)
    ob = input(title=”Overbought Level”, type=integer, defval=70)
    os = input(title=”Oversold Level”, type=integer, defval=30)

    // END SETUP //

    ////////////////////////
    // BULLISH DIVERGENCE //
    ////////////////////////

    // define lower low in price //

    srcLL = src > lowest(src,x)*(1+revpct) and lowest(src,x)<lowest(src,z)[x]

    // define higher low in rsi //

    rsiHL = rv>lowest(rv,x) and lowest(rv,x) > lowest(rv,z)[x] and lowest(rv,x)<os

    BullishDiv = srcLL and rsiHL
    BullishDivAlert = iff(barssince(BullishDiv)<alert,10,0)+50

    ////////////////////////
    // BEARISH DIVERGENCE //
    ////////////////////////

    // define higher high in price //

    srcHH = src < highest(src,x)*(1-revpct) and highest(src,x)>highest(src,z)[x]

    // define lower high in RSI //

    rsiLH = rv<highest(rv,x) and highest(rv,x) < highest(rv,z)[x] and highest(rv,x)>ob

    BearishDiv = srcHH and rsiLH
    BearishDivAlert = iff(barssince(BearishDiv)<alert,-10,0)+50

    zero = plot(50)
    BULLD = plot(BullishDivAlert, color = green)
    BEARD = plot(BearishDivAlert, color = red)
    fill(BULLD,zero,color=green, transp=50)
    fill(zero,BEARD,color=red, transp=50)
    plot(rv, color = blue)
    plot(30, color = gray)
    plot(70, color = gray)

    #246815 quote
    Iván González
    Moderator
    Master

    Por casualidad he llegado a este post.

    //-----------------------------------------------//
    //-----------------------------------------------//
    // inputs
    //-----------------------------------------------//
    src=(open+high+low+close)/4
    x=5
    z=25
    revpct=0.01
    ialert=25
    rsiprd=14
    ob=70
    os=30
    //-----------------------------------------------//
    
    //-----------------------------------------------//
    rv=rsi[rsiprd](src)
    //-----------------------------------------------//
    // Bullish Divergence
    //-----------------------------------------------//
    //--- Define lower low in price
    llvx=lowest[x](src)
    llvz=lowest[z](src)
    srcLL=src>llvx*(1+revpct) and llvx<llvz[x]
    //--- Define higher low in RSI
    llvrsix=lowest[x](rv)
    llvrsiz=lowest[z](rv)
    rsiHL=rv>llvrsix and llvrsix>llvrsiz[x] and llvrsix<os
    
    bullishDiv=srcLL and rsiHL
    
    if bullishDiv then
    count=1
    else
    count=1+count
    endif
    
    if count<ialert then
    bullishDivAlert=10+50
    else
    bullishDivAlert=50
    endif
    colorbetween(bullishDivAlert,50,"green",100)
    //-----------------------------------------------//
    // Bearish Divergence
    //-----------------------------------------------//
    //--- define higher high in price
    hhvx=highest[x](src)
    hhvz=highest[z](src)
    srcHH=src<hhvx*(1-revpct) and hhvx>hhvz[x]
    
    //--- define lower high in rsi
    hhvrsix=highest[x](rv)
    hhvrsiz=highest[z](rv)
    rsiLH=rv<hhvrsix and hhvrsix<hhvrsiz[x] and hhvrsix>ob
    
    bearishDiv=srcHH and rsiLH
    if bearishDiv then
    countbear=1
    else
    countbear=1+countbear
    endif
    
    if countbear<ialert then
    bearishDivAlert=50-10
    else
    bearishDivAlert=50
    endif
    colorbetween(bearishDivAlert,50,"red",100)
    //-----------------------------------------------//
    if bullishdiv then
    red=0
    green=255
    blue=0
    elsif bearishdiv then
    red=255
    green=0
    blue=0
    else
    red=0
    green=0
    blue=255
    endif
    //-----------------------------------------------//
    return rv as "RSI" coloured(red,green,blue)style(line,2), bullishDivAlert coloured("green"), bearishDivAlert coloured("red"), ob style(dottedline), os style(dottedline), 50 as "midline"
    Fr7 thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Traducción de indicador :"CDC RSI Divergence"a PRT


ProBuilder: Indicadores y Herramientas

New Reply
Author
author-avatar
Fr7 @fr7 Participant
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by Iván González
9 months, 1 week ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 04/11/2018
Status: Active
Attachments: No files
Logo Logo
Loading...