Linea de tendencia Unir los dos puntos máximos en el periodo de 1 año

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #210616 quote
    Mikel9300
    Participant
    New

    Hola,

    Me gustaría saber si es posible hacer un indicador de línea con la siguiente característica (adjunto fotos con ejemplos):

    • Unir los dos puntos máximos en el periodo de 1 año

    Gracias

    #213962 quote
    robertogozzi
    Moderator
    Master

    No es fácil detectar las oscilaciones altas correctas dentro de 1 año.
    Dividí ese período en dos períodos de 26 semanas.
    Espero que te guste:

    DEFPARAM DrawOnLastBarOnly = true
    H1   = highest[26](high[26])
    Bar1 = BarIndex[51]
    FOR i = 51 DOWNTO 26
       IF high[i] = H1 THEN
          Bar1 = BarIndex[i]
          break
       ENDIF
    NEXT
    H2   = highest[26](high)
    Bar2 = BarIndex[25]
    FOR i = 25 DOWNTO 0
       IF high[i] = H2 THEN
          Bar2 = BarIndex[i]
          break
       ENDIF
    NEXT
    Pdiff = H2 - H1
    Bdiff = (Bar2 - Bar1) - 1
    Ptemp = Pdiff / Bdiff
    Btemp = (BarIndex - Bar2)
    H3    = round(H2 + (Ptemp * Btemp),5)
    DrawSegment(Bar1,H1,BarIndex+1,H3) style(line,3) coloured("Blue")
    //Offset = highest[52](high) + range
    //DrawText("Bar1:        #Bar1#",BarIndex,Offset)
    //DrawText("Bar2:        #Bar2#",BarIndex,Offset * 1.005)
    //DrawText("Bdiff:          #Bdiff#",BarIndex,Offset * 1.010)
    //DrawText("H1:     #H1#",BarIndex,Offset * 1.015)
    //DrawText("H2:     #H2#",BarIndex,Offset * 1.020)
    //DrawText("Pdiff:     #Pdiff#",BarIndex,Offset * 1.025)
    //DrawText("H3:     #H3#",BarIndex,Offset * 1.030)
    RETURN
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Linea de tendencia Unir los dos puntos máximos en el periodo de 1 año


ProBuilder: Indicadores y Herramientas

New Reply
Author
author-avatar
Mikel9300 @mikel9300 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
2 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 02/27/2023
Status: Active
Attachments: 6 files
Logo Logo
Loading...