SUPERTREND RSI para transcribir

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

    Hola a todos, os remito el presente indicador de la plataforma TRADINGVIEW para ver si sois capaces de transcribirlo a PRT. Gracias

    https://es.tradingview.com/v/tjP35RG5/

    Captura-de-pantalla-2024-06-02-171513.png Captura-de-pantalla-2024-06-02-171513.png
    #233464 quote
    Iván González
    Moderator
    Master

    Hola!
    Aquí lo tienes https://www.prorealcode.com/prorealtime-indicators/rsi-supertrend-a-trend-and-momentum-indicator/

    //--------------------------------------------------------------------//
    //PRC_RSI Supertrend
    //version = 0
    //03.06.24
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //--------------------------------------------------------------------//
    //-----Inputs---------------------------------------------------------//
    relativeStrengthIndexLength=14
    smoothingLength=21
    rsiInputSource = customclose
    isSmoothed=0
    
    movingAverageLength=14
    movingAverageType=7 //
    showMovingAverage=1
    
    trendFactor=0.8
    averageTrueRangeLength=10
    
    obline=70
    osline=30
    midline=50
    transparency=80
    //--------------------------------------------------------------------//
    //-----RSI Calculation------------------------------------------------//
    if isSmoothed then
    auxrsi=rsi[relativeStrengthIndexLength](rsiInputSource)
    myrsi=hullaverage[smoothingLength](auxrsi)
    else
    myrsi=rsi[relativeStrengthIndexLength](rsiInputSource)
    endif
    rsiMovingAverage=average[movingAverageLength,movingAverageType](myrsi)
    //--------------------------------------------------------------------//
    //-----Calculating Supertrend based on RSI values---------------------//
    pricesource=myrsi
    
    highestHigh=highest[averageTrueRangeLength](pricesource)
    lowestlow=lowest[averageTrueRangeLength](pricesource)
    
    if barindex <= averageTrueRangeLength then
    truerange=highestHigh-lowestlow
    else
    truerange=max(highestHigh-lowestlow,max(abs(highestHigh-pricesource[1]),abs(lowestlow-pricesource[1])))
    endif
    
    alpha = 1/averageTrueRangeLength
    
    if barindex <= 4*averageTrueRangeLength then
    atr = average[averageTrueRangeLength](truerange)
    else
    atr = alpha*truerange + (1-alpha)*atr[1]
    endif
    
    up = pricesource - trendFactor*atr
    
    up1 = up[1]
    if pricesource[1] > up1 then
    up = max(up,up1)
    else
    up = up
    endif
    
    dn = pricesource + trendFactor*atr
    dn1 = dn[1]
    if pricesource[1] < dn1 then
    dn = min(dn,dn1)
    else
    dn = dn
    endif
    
    once trend = 1
    
    if trend = -1 and pricesource > dn1 then
    trend = 1
    elsif trend = 1 and pricesource < up1 then
    trend = -1
    else
    trend = trend
    endif
    
    if trend = 1 then
    mysupertrend = up
    else
    mysupertrend = dn
    endif
    //--------------------------------------------------------------------//
    if trend=1 then
    r=0
    g=255
    b=187
    else
    r=255
    g=17
    b=0
    endif
    //--------------------------------------------------------------------//
    colorbetween(mysupertrend,pricesource,r,g,b,transparency)
    //--------------------------------------------------------------------//
    if mysupertrend crosses over pricesource and mysupertrend>Obline then
    drawtext("▼",barindex,mysupertrend+2)coloured("red")
    elsif mysupertrend crosses under pricesource and mysupertrend<osline then
    drawtext("▲",barindex,mysupertrend-2)coloured("green")
    endif
    //--------------------------------------------------------------------//
    return pricesource,mysupertrend coloured(r,g,b),rsiMovingAverage coloured("grey")style(line,2),obline as "Overbought Line" coloured("grey")style(dottedline),osline as "Overbought Line" coloured("grey")style(dottedline),midline as "Middle Line" coloured("grey")style(dottedline2)
    thanked this post
    #233647 quote
    deletedaccount22102025
    Participant
    New

    Magnífico Iván, enhorabuena. Muchísimas gracias. Eres un gran fichaje aquí en PRT.

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

SUPERTREND RSI para transcribir


ProBuilder: Indicadores y Herramientas

New Reply
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by deletedaccount22102025
1 year, 9 months ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 06/02/2024
Status: Active
Attachments: 1 files
Logo Logo
Loading...