INDICADOR TANGENT CROSSING

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #232964 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/F2vJnCdI/

    #233254 quote
    Iván González
    Moderator
    Master

    Buenas!
    Aquí tienes una aproximación del código.

    //-------------------------------------------------------------------------------//
    //PRC_Ghost Tangent Crossings
    //version = 0
    //2024.05.29
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //-------------------------------------------------------------------------------//
    //-----Inputs--------------------------------------------------------------------//
    //-----Pivots
    lbR=25//lookback Right
    lbL=lbR//lookback Left
    maxzig=10
    pivotType=1//1=high/low 0=open/close
    if pivotType then
    src1=low
    src2=high
    else
    src1=min(open,close)
    src2=max(open,close)
    endif
    //-------------------------------------------------------------------------------//
    //-----Pivots High-Low ----------------------------------------------------------//
    //-----pivots low
    if src1 > src1[lbR] and lowest[lbR](src1) > src1[lbR] and src1[lbR] < lowest[lbL](src1)[lbR+1] then
    $pl[z+1]=src1[lbR]
    $plx[z+1]=barindex[lbR]
    z=z+1
    drawpoint($plx[z],$pl[z],2)
    endif
    //-----pivots high
    if src2 < src2[lbR] and highest[lbR](src2)<src2[lbR] and src2[lbR]>highest[lbL](src2)[lbR+1] then
    $ph[t+1]=src2[lbR]
    $phx[t+1]=barindex[lbR]
    t=t+1
    drawpoint($phx[t],$ph[t],2)
    endif
    //-------------------------------------------------------------------------------//
    //-------------------------------------------------------------------------------//
    polarityUp=$phx[t]>$plx[z]
    polarityDw=$phx[t]<$plx[z]
    //-----Ellipse-------------------------------------------------------------------//
    if z<>z[1] and polarityDw and $plx[max(0,z-1)]<$phx[t] then
    startx = $plx[z]
    endx = $phx[t]
    starty = $pl[z]
    endy = $ph[t]
    a = (endx - startx)
    b = (endy - starty)
    prevx = -1
    newx = 0
    y = 0
    
    for i = 90 to 180 do
    newx = a * cos(i)
    y = b * sin(i)
    if prevx <> newx then
    drawpoint(endx + newx, starty + y)coloured("red")
    endif
    prevx = newx
    next
    
    midangle=135
    midx=a*cos(midangle)
    midy=b*sin(midangle)
    
    tangentx=endx+midx
    tangenty=starty+midy
    
    slope=-(b*b*midx)/(a*a*midy)
    intercept = tangenty - slope * tangentx
    
    length = 20
    x1 = tangentx - length
    y1 = tangenty - length * slope
    x2 = barindex
    y2 = slope*x2+intercept
    endif
    
    if t<>t[1] and polarityUp and $phx[max(0,t-1)]<$plx[z] then
    startx = $plx[z]
    endx = $phx[t]
    starty = $pl[z]
    endy = $ph[t]
    a = (endx - startx)
    b = (endy - starty)
    prevx = -1
    newx = 0
    y = 0
    
    for i = 270 to 360 do
    newx = a * cos(i)
    y = b * sin(i)
    if prevx <> newx then
    drawpoint(startx + newx, endy + y)coloured("green")
    endif
    prevx = newx
    next
    
    midangle=315
    midx=a*cos(midangle)
    midy=b*sin(midangle)
    
    tangentx=startx+midx
    tangenty=endy+midy
    
    slope=-(b*b*midx)/(a*a*midy)
    intercept = tangenty - slope * tangentx
    
    length = 20 // Ajusta la longitud de la tangente según sea necesario
    x1 = tangentx - length
    y1 = tangenty - length * slope
    x2 = barindex
    y2 = slope*x2+intercept
    endif
    //-------------------------------------------------------------------------------//
    if islastbarupdate then
    if $plx[z]>$phx[t] then
    startx = $plx[z]
    endx = barindex-barssince(highest[barindex-startx](high)=high)
    starty = $pl[z]
    endy = highest[barindex-startx](high)
    a = (endx - startx)
    b = (endy - starty)
    prevx = -1
    newx = 0
    y = 0
    
    for i = 270 to 360 do
    newx = a * cos(i)
    y = b * sin(i)
    if prevx <> newx then
    drawpoint(startx + newx, endy + y)coloured("green")
    endif
    prevx = newx
    next
    
    midangle=315
    midx=a*cos(midangle)
    midy=b*sin(midangle)
    
    tangentx=startx+midx
    tangenty=endy+midy
    
    slope=-(b*b*midx)/(a*a*midy)
    intercept = tangenty - slope * tangentx
    
    length = 20 // Ajusta la longitud de la tangente según sea necesario
    x1 = tangentx - length
    y1 = tangenty - length * slope
    x2 = barindex+length
    y2 = slope*x2+intercept
    
    drawpoint(tangentx, tangenty) coloured("blue")
    drawsegment(x1, y1, x2, y2) coloured("blue")
    
    else
    startx = $phx[t]
    endy = lowest[barindex-startx](low)
    endx = barindex-barssince(lowest[barindex-startx](low)=low)
    starty = $ph[t]
    
    a = (endx - startx)
    b = (endy - starty)
    prevx = -1
    newx = 0
    y = 0
    
    for i = 90 to 180 do
    newx = a * cos(i)
    y = b * sin(i)
    if prevx <> newx then
    drawpoint(startx - newx, endy - y)coloured("red")
    endif
    prevx = newx
    next
    
    midangle=135
    midx=a*cos(midangle)
    midy=b*sin(midangle)
    
    tangentx=startx-midx
    tangenty=endy-midy
    
    slope=-(b*b*midx)/(a*a*midy)
    intercept = tangenty - slope * tangentx
    
    length = 20 // Ajusta la longitud de la tangente según sea necesario
    x1 = tangentx - length
    y1 = tangenty - length * slope
    x2 = barindex+length
    y2 = slope*x2+intercept
    
    drawpoint(tangentx, tangenty) coloured("blue")
    drawsegment(x1, y1, x2, y2) coloured("blue")
    endif
    endif
    //-------------------------------------------------------------------------------//
    //-------------------------------------------------------------------------------//
    //-------------------------------------------------------------------------------//
    return
    
    thanked this post
    #233257 quote
    deletedaccount22102025
    Participant
    New

    Muchísimas gracias Iván. Gran trabajo !!!. Si pudieras rematar el trabajo con el detalle de que hay veces dibuja el arco en la zona izquierda del precio (tomando punto central del arco a la izquierda) al igual que su tangente y debería ser siempre a la derecha de dicho punto.

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

INDICADOR TANGENT CROSSING


ProBuilder: Indicadores y Herramientas

New Reply
Summary

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

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