Ayuda con codigo para indicar tenendecia y acelaracion alcista en el grafico

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

    Buenas Tardes, he programado este indicador pero me muestra un error que no se como solucionarlo, la idea es que el indicador me muestre un texto en el grafico con 3 estrellas cuando se dan las condiciones de tendencia alcista y de aceleracion (histograma del MACD creciendo), agredecere ayuda con identificacion del error, gracias de antemano.

    DefParam DrawOnLastBarOnly = true
    Xoffset = (OffsetText) //
    //BackColor = 0 //
    // --- Init
    
    BackgroundColor(255,255,255,255)
    OffsetText = max(1,OffsetText)
    OffsetText = min(200,OffsetText)
    
    indicator1 = WeightedAverage[50](close)
    indicator2 = WeightedAverage[150](close)
    c1 = (indicator1[1] >= indicator2[1])
    
    indicator3 = WeightedAverage[150](close)
    indicator4 = WeightedAverage[200](close)
    c2 = (indicator3 >= indicator4)
    
    if c1 and c2 then // tendencia
    p1=1
    endif
    
    indicator5 = MACD[12,26,9](close)
    c3 = (indicator5 > indicator5[2])
    
    indicator6 = MACD[12,26,9](close)
    c4 = (indicator6 > indicator6[1])
    
    indicator8 = MACD[12,26,9](close)
    c8 = (indicator8 >= indicator8)
    
    if c3 and c4 and c8 then // aceleracion
    p2= 1
    endif
    
    if p=2 then
    DrawText("★★★",barindex[5]-(Xoffset),1,MonoSpaced,Bold,10) coloured(255,105,180)//PINK
    DrawText("FTA",barindex[5]-(Xoffset),0.7,MonoSpaced,Bold,10)coloured(255,105,180)
    BackgroundColor(255,105,180,80) // red
    ENDIF
    
    return p
    #181199 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    En las líneas 35 y 41 está la variable  p  que no ha sido definida, tienes que definirla en alguna parte.

    #181758 quote
    LiriosLirios
    Participant
    New

    Gracias, he agregado la variable p=0 en la linea 20 pero el problema persiste, no puedo identificar cual es el error, le agradecería enormemente su ayuda.

    //////////////////////////////////////////////

    DefParam DrawOnLastBarOnly = true
    Xoffset = (OffsetText) // Distance entre Texte et Bord droit du tableau (4 par défaut)
    //BackColor = 0 // Case à cocher pour couleur de fond (inactif par défaut)
    // — Init

    BackgroundColor(255,255,255,255)
    OffsetText = max(1,OffsetText)
    OffsetText = min(200,OffsetText)

    indicator1 = WeightedAverage[50](close)
    indicator2 = WeightedAverage[150](close)
    c1 = (indicator1[1] >= indicator2[1])

    indicator3 = WeightedAverage[150](close)
    indicator4 = WeightedAverage[200](close)
    c2 = (indicator3 >= indicator4)

    p=0
    if c1 and c2 then
    p=1
    else
    p=0
    endif
    rem **********************************

    indicator11 = WeightedAverage[50](close)
    indicator21 = WeightedAverage[50](close)
    c5 = (indicator11[2] < indicator21[close])

    indicator31 = WeightedAverage[50](close)
    indicator41 = WeightedAverage[50](close)
    c6 = (indicator31[2] >= indicator41[close])

    if c5 and c6 then
    p=p+1

    endif

    rem **********************************************

    indicator5 = MACD[12,26,9](close)
    c3 = (indicator5 > indicator5[2])

    indicator6 = MACD[12,26,9](close)
    c4 = (indicator6 > indicator6[1])

    indicator8 = MACD[12,26,9](close)
    c8 = (indicator8 >= indicator8)

    if c3 and c4 and c8 then
    p= p+1
    endif
    //*************************************************

    a=ROC[60](close)
    b=ROC[120](close)

    pr = round (a+b)
    c7 = (pr >= 0)

    if c7 then
    p=p+1
    endif

    if p=3 then
    BackgroundColor(0,160,250,40) // light blue
    DrawText(“▲▲▲▲”,barindex[4]-(Xoffset),0.5,MonoSpaced,Bold,10) coloured(0,160,250)// light blue

    endif

    if p=2 then
    DrawText(“▲▲▲”,barindex[5]-(Xoffset),1,MonoSpaced,Bold,10) coloured(255,105,180)//PINK
    BackgroundColor(255,105,180,80) // red
    ENDIF

    if p=1 then
    DrawText(“▲▲”,barindex[4]-(Xoffset),1,MonoSpaced,Bold,10) coloured(250,160,0)// yellow
    BackgroundColor(250,160,0,40) // yellow
    endif

    if p=0 then
    DrawText(“▲”,barindex[4]-(Xoffset),0.5,MonoSpaced,Bold,10) coloured(222,184,135)//wood
    BackgroundColor(222,184,135,90)
    endif

    return p

    #181810 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    En la línea 2 usa OffsetText , pero no retiene ningún valor.

    En las líneas 28 y 32, ¿por qué escribió CLOSE entre corchetes ? Debe escribir el ID de la vela (0, 1, 2, etc.) entre corchetes .

    #181824 quote
    LiriosLirios
    Participant
    New

    He corregido los errores y funciona estupendamente. mil gracias!

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Ayuda con codigo para indicar tenendecia y acelaracion alcista en el grafico


ProBuilder: Indicadores y Herramientas

New Reply
Author
author-avatar
Lirios @lirios Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by LiriosLirios
4 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicadores y Herramientas
Language: Spanish
Started: 11/07/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...