INDICADOR RADIUS TREND TRADINGVIEW

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

    Hola a todos, a ver si me podéis ayudar a transcribir el siguiente código del indicador Radius Trend de Tradingview.

    https://es.tradingview.com/v/4KIHf36j/

     

    // Indicator: Radius Trend [ChartPrime]

    // User Inputs
    DEFPARAM Step = 0.15 // Radius Step
    DEFPARAM Multi = 2 // Start Points Distance

    // Initialize variables
    Var Trend = 0
    Var Multi1 = 0
    Var Multi2 = 0
    Var N = 3
    Var Band = 0

    // Calculate distances for band placement
    Distance = Average100 * Multi
    Distance1 = Average100 * 0.2

    // Initialize trend and band on the 101st bar
    IF BarIndex = 101 THEN
    Trend = 1
    Band = Low * 0.8
    ENDIF

    // Update trend based on price relation to band
    IF Close < Band THEN
    Trend = 0
    ENDIF

    IF Close > Band THEN
    Trend = 1
    ENDIF

    // Adjust band on trend changes
    IF Trend[1] = 0 AND Trend = 1 THEN
    Band = Low – Distance
    ENDIF

    IF Trend[1] = 1 AND Trend = 0 THEN
    Band = High + Distance
    ENDIF

    // Apply step angle to trend lines
    IF BarIndex MOD N = 0 AND Trend = 1 THEN
    Multi1 = 0
    Multi2 = Multi2 + Step
    Band = Band + Distance1 * Multi2
    ENDIF

    IF BarIndex MOD N = 0 AND Trend = 0 THEN
    Multi1 = Multi1 + Step
    Multi2 = 0
    Band = Band – Distance1 * Multi1
    ENDIF

    // Smooth the band
    Sband = AverageN

    // Set color based on trend
    Color = IF Trend = 1 THEN RGB(84, 182, 212) ELSE RGB(207, 43, 43)

    // Calculate upper and lower bands
    BandUpper = AverageN
    BandLower = AverageN
    Band1 = IF Trend = 1 THEN BandUpper ELSE BandLower

    // Visualization
    // Plot the outer band
    IF BarIndex MOD 2 = 0 THEN
    DRAWBAND(Band1, Color, 50)
    ENDIF

    // Plot the main band and fill area
    P1 = DRAWLINE(Trend = 0, Sband, Color)
    P2 = DRAWLINE(Average20 / 2, Color, 0)

    FILL(P1, P2, Band, Average20 / 2, Color, 60)

    #238413 quote
    robertogozzi
    Moderator
    Master

    Me he dado cuenta de que en todos tus posts siempre escribes los títulos en mayúsculas y desde hace aproximadamente un año añades al final de ellos muchos símbolos repetidos obsesivamente (asteriscos, signos de exclamación, etc…).
    Evidentemente es un intento de buscar mayor atención y una respuesta más rápida.
    Les recuerdo que NETIQUETTE desaconseja el uso de todas las letras mayúsculas, excepto excepcionalmente para poner énfasis en una palabra específica. El uso de MAYÚSCULAS se considera de mala educación ya que se equipara a “gritar” para hacerse oír entre los demás.
    Gracias por tu cooperación 🙂

    #238425 quote
    deletedaccount22102025
    Participant
    New

    Gracias por tu pronta respuesta Señor Roberto. Lo de mala educación en cuanto a las letras mayúsculas depende del contexto y parte de una conversación. Puesto que no se trata de una conversación sino de un “Título” no se da el caso que describes. Según tu criterio los títulos de libros, textos y películas serían de mala educación. Creo honestamente que estás en un error.

    De todos modos gracias por tu aporte.

    #238466 quote
    Iván González
    Moderator
    Master

    Buenas tardes.
    Ahí va el código:

    //--------------------------------------------------//
    //PRC_Radius Trend
    //version = 0
    //03.10.2024
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //--------------------------------------------------//
    //-------------------Inputs-------------------------//
    //--------------------------------------------------//
    step=0.15 //Radius step
    multi=2 //Start Points Distance
    n=3
    //--------------------------------------------------//
    //-----------Indicator Calculations-----------------//
    //--------------------------------------------------//
    //Calculate distance for band placement
    distance=average[100](high-low)*multi
    distance1=average[100](high-low)*0.2
    //--------------------------------------------------//
    //Initialize trend and band on 101st bar
    once trend=0
    once band=0
    if barindex=101 then
    trend=1
    band=low*0.8
    endif
    //--------------------------------------------------//
    //Update trend based on price relation to band
    if close<band then
    trend=0
    r=207
    g=43
    b=43
    elsif close>band then
    trend=1
    r=84
    g=182
    b=212
    endif
    //--------------------------------------------------//
    //Adjust band on trend changes
    if trend[1]=0 and trend<>trend[1]then
    band=low-distance
    alpha=0
    elsif trend[1]=1 and trend<>trend[1]then
    band=high+distance
    alpha=0
    else
    alpha=255
    endif
    //--------------------------------------------------//
    //Apply step angle to trend lines
    once multi1=0
    once multi2=0
    if barindex MOD n = 0 and trend=1 then
    multi1=0
    multi2=multi2+step
    band=band+distance1*multi2
    endif
    if barindex MOD n = 0 and trend=0 then
    multi1=step+multi1
    multi2=0
    band=band-distance1*multi1
    endif
    //--------------------------------------------------//
    //Smooth the band
    Sband=average[n](band)
    //--------------------------------------------------//
    //Calculate upper and lower bands
    bandUpper=average[n](band+distance*0.5)
    bandLower=average[n](band-distance*0.5)
    if trend=1 then
    band1=bandUpper
    else
    band1=bandLower
    endif
    //--------------------------------------------------//
    //Fill color
    avgHL2=average[20]((high+low)/2)
    if barindex>101 then
    colorbetween(Sband,avgHL2,r,g,b,alpha*0.2)
    endif
    //--------------------------------------------------//
    return sband coloured("grey",alpha)style(line,2), band1 coloured("grey",alpha)style(dottedline,1)
    thanked this post
    #238482 quote
    deletedaccount22102025
    Participant
    New

    Muchas gracias Iván. Eres un crack….Vaya cambio de foro con tu incorporación. ya estaba a punto de desistir de él. Un saludo

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

INDICADOR RADIUS TREND TRADINGVIEW


ProBuilder: Indicadores y Herramientas

New Reply
Summary

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

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