Doble techo, doble suelo

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

    Hola, me gustaría obtener un screener del indicador que detecta doble suelo o techo, en concreto me gustaría que me avisara cuando se forme el rectángulo verde o rojo del doble suelo o doble suelo, aquí dejo el código del indicador que hizo Iván hace un año, gracias de antemano:

     

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    //———————————————————-//
    //PRC_Double Top and Bottom
    //version = 0
    //16.07.2024
    //Iván González @ http://www.prorealcode.com
    //Sharing ProRealTime knowledge
    //———————————————————-//
    //—–inputs
    prd = 5
    tol = 15
    showPivot=1
    Show2Bot=1
    Show2Top=1
    ShowShort=1
    ShowLong=1
    src1 = low
    src2 = high
    //———————————————————-//
    //—–Pivots High&Low————————————–//
    ph = high=highest[prd](high)
    pl = low=lowest[prd](low)
    //———————————————————-//
    //—–Direction Calculation——————————–//
    if ph and pl=0 then
    dir=1
    elsif pl and ph=0 then
    dir=1
    else
    dir=dir
    endif
    dirchanged=dir<>dir[1]
    //———————————————————-//
    //—–Calculate Arrays for each pivot———————-//
    if ph or pl then
    if dirchanged then
    if dir=1 then
    $zigzag[t+1]=highest[prd](high)
    $zigzagidx[t+1]=barindex
    $dir[t+1]=1
    t=t+1
    elsif dir=1 then
    $zigzag[t+1]=lowest[prd](low)
    $zigzagidx[t+1]=barindex
    $dir[t+1]=1
    t=t+1
    endif
    else
    if dir=1 and highest[prd](high)> $zigzag[t] then
    $zigzag[t]=highest[prd](high)
    $zigzagidx[t]=barindex
    elsif dir=1 and lowest[prd](low)< $zigzag[t] then
    $zigzag[t]=lowest[prd](low)
    $zigzagidx[t]=barindex
    endif
    endif
    endif
    //———————————————————-//
    if t>4 then
    //—–Double Top pattern—————————-//
    htop=($zigzag[t3]+$zigzag[t1])/2$zigzag[t2]
    TopHigh=$zigzag[t3]+htop*tol/100
    BotHigh=$zigzag[t3]htop*tol/100
    DoubleTop=($zigzag[t1]>=BotHigh and $zigzag[t1]<=TopHigh) and ($zigzag[t3]>y1 and $zigzag[t3]>$zigzag[t2] and $zigzag[t1]>$zigzag[t2])
    if DoubleTop and not DoubleTop[1] then
    checkTop=1
    short=0
    x1=$zigzagidx[t4]
    y1=$zigzag[t4]
    x2=$zigzagidx[t3]
    y2=$zigzag[t3]
    x3=$zigzagidx[t2]
    y3=$zigzag[t2]
    x4=$zigzagidx[t1]
    y4=$zigzag[t1]
    x5=$zigzagidx[t]
    y5=$zigzag[t]
    dist=abs(y3min(y2,y4))
    if Show2Top then
    drawrectangle(x2,y2,x4,y4)coloured(“red”)fillcolor(“red”,50)
    endif
    endif
    if checkTop and ShowShort then
    if not short and close crosses under y3 then
    short=1
    tpsh=(y3dist)
    slsh=max(y2,y4)
    drawarrowdown(barindex,high)coloured(“blue”)
    drawsegment(x3,y3,barindex,y3)coloured(“blue”)
    endif
    if short and low crosses under tpsh then
    short=0
    checkTop=0
    Drawsegment(x3,tpsh,barindex,tpsh)coloured(“blue”)style(dottedline)
    drawarrowup(barindex,low)coloured(“orange”)
    endif
    if short and close crosses over slsh then
    checkTop=0
    short=0
    Drawsegment(x4,slsh,barindex,slsh)coloured(“blue”)style(dottedline)
    drawarrowup(barindex,low)coloured(“orange”)
    endif
    endif
    //—–Double Bottom pattern————————//
    hbot=$zigzag[t2]($zigzag[t3]+$zigzag[t1])/2
    topLow=$zigzag[t3]+hbot*tol/100
    botLow=$zigzag[t3]hbot*tol/100
    DoubleBot=($zigzag[t1]>=botLow and $zigzag[t1]<=toplow) and ($zigzag[t3]<$zigzag[t4] and $zigzag[t3]<$zigzag[t2] and $zigzag[t1]<$zigzag[t2])
    if DoubleBot and not DoubleBot[1] then
    checkBot=1
    xx1=$zigzagidx[t4]
    yy1=$zigzag[t4]
    xx2=$zigzagidx[t3]
    yy2=$zigzag[t3]
    xx3=$zigzagidx[t2]
    yy3=$zigzag[t2]
    xx4=$zigzagidx[t1]
    yy4=$zigzag[t1]
    xx5=$zigzagidx[t]
    yy5=$zigzag[t]
    dist1=abs(yy3min(yy2,yy4))
    if Show2Bot then
    drawrectangle(xx2,yy2,xx4,yy4)coloured(“green”)fillcolor(“green”,50)
    endif
    endif
    if checkbot and ShowLong then
    if not long and close crosses over yy3 then
    long=1
    tp=yy3+dist1
    sl=min(yy2,yy4)
    drawarrowup(barindex,low)coloured(“green”)
    drawsegment(xx3,yy3,barindex,yy3)coloured(“blue”)
    endif
    if long and high crosses over tp then
    long=0
    checkBot=0
    Drawsegment(xx3,tp,barindex,tp)coloured(“blue”)style(dottedline)
    drawarrowdown(barindex,high)coloured(“red”)
    endif
    if long and close crosses under sl then
    checkBot=0
    long=0
    Drawsegment(xx4,sl,barindex,sl)coloured(“blue”)style(dottedline)
    drawarrowdown(barindex,high)coloured(“red”)
    endif
    endif
    endif
    //—–Draw Pivots——————————————//
    if islastbarupdate  and showPivot then
    for i=t downto 4 do
    drawpoint($zigzagidx[i],$zigzag[i],2)coloured(“blue”,100)
    next
    endif
    //———————————————————-//
    return
    #254557 quote
    robertogozzi
    Moderator
    Master

    Aquí está (me parece que es del tipo repintado, por lo que la señal no es inmediata):

    //———————————————————-//
    //PRC_Double Top and Bottom
    //version = 0
    //16.07.2024
    //Iván González @ http://www.prorealcode.com
    //Sharing ProRealTime knowledge
    //———————————————————-//
    //—-inputs
    prd = 5
    tol = 15
    showPivot=1
    Show2Bot=1
    Show2Top=1
    ShowShort=1
    ShowLong=1
    //src1 = low
    //src2 = high
    //———————————————————-//
    //—-Pivots High&Low————————————-//
    ph = high=highest[prd](high)
    pl = low=lowest[prd](low)
    //———————————————————-//
    //—-Direction Calculation——————————-//
    if ph and pl=0 then
    dir=1
    elsif pl and ph=0 then
    dir=-1
    else
    dir=dir
    endif
    dirchanged=dir<>dir[1]
    Box = 0
    //———————————————————-//
    //—-Calculate Arrays for each pivot———————-//
    if ph or pl then
    if dirchanged then
    if dir=1 then
    $zigzag[t+1]=highest[prd](high)
    $zigzagidx[t+1]=barindex
    $dir[t+1]=1
    t=t+1
    elsif dir=-1 then
    $zigzag[t+1]=lowest[prd](low)
    $zigzagidx[t+1]=barindex
    $dir[t+1]=-1
    t=t+1
    endif
    else
    if dir=1 and highest[prd](high)> $zigzag[t] then
    $zigzag[t]=highest[prd](high)
    $zigzagidx[t]=barindex
    elsif dir=-1 and lowest[prd](low)< $zigzag[t] then
    $zigzag[t]=lowest[prd](low)
    $zigzagidx[t]=barindex
    endif
    endif
    endif
    //———————————————————-//
    if t>4 then
    //—-Double Top pattern—————————-//
    htop=($zigzag[t-3]+$zigzag[t-1])/2-$zigzag[t-2]
    TopHigh=$zigzag[t-3]+htop*tol/100
    BotHigh=$zigzag[t-3]-htop*tol/100
    DoubleTop=($zigzag[t-1]>=BotHigh and $zigzag[t-1]<=TopHigh) and ($zigzag[t-3]>y1 and $zigzag[t-3]>$zigzag[t-2] and $zigzag[t-1]>$zigzag[t-2])
    if DoubleTop and not DoubleTop[1] then
    checkTop=1
    short=0
    //x1=$zigzagidx[t-4]
    y1=$zigzag[t-4]
    //x2=$zigzagidx[t-3]
    y2=$zigzag[t-3]
    //x3=$zigzagidx[t-2]
    y3=$zigzag[t-2]
    //x4=$zigzagidx[t-1]
    y4=$zigzag[t-1]
    //x5=$zigzagidx[t]
    //y5=$zigzag[t]
    dist=abs(y3-min(y2,y4))
    if Show2Top then
    //drawrectangle(x2,y2,x4,y4)coloured("red")fillcolor("red",50)
    Box = 2
    endif
    endif
    if checkTop and ShowShort then
    if not short and close crosses under y3 then
    short=1
    tpsh=(y3-dist)
    slsh=max(y2,y4)
    //drawarrowdown(barindex,high)coloured("blue")
    //drawsegment(x3,y3,barindex,y3)coloured("blue")
    endif
    if short and low crosses under tpsh then
    short=0
    checkTop=0
    //Drawsegment(x3,tpsh,barindex,tpsh)coloured("blue")style(dottedline)
    //drawarrowup(barindex,low)coloured("orange")
    endif
    if short and close crosses over slsh then
    checkTop=0
    short=0
    //Drawsegment(x4,slsh,barindex,slsh)coloured("blue")style(dottedline)
    //drawarrowup(barindex,low)coloured("orange")
    endif
    endif
    //—-Double Bottom pattern————————//
    hbot=$zigzag[t-2]-($zigzag[t-3]+$zigzag[t-1])/2
    topLow=$zigzag[t-3]+hbot*tol/100
    botLow=$zigzag[t-3]-hbot*tol/100
    DoubleBot=($zigzag[t-1]>=botLow and $zigzag[t-1]<=toplow) and ($zigzag[t-3]<$zigzag[t-4] and $zigzag[t-3]<$zigzag[t-2] and $zigzag[t-1]<$zigzag[t-2])
    if DoubleBot and not DoubleBot[1] then
    checkBot=1
    //xx1=$zigzagidx[t-4]
    //yy1=$zigzag[t-4]
    //xx2=$zigzagidx[t-3]
    yy2=$zigzag[t-3]
    //xx3=$zigzagidx[t-2]
    yy3=$zigzag[t-2]
    //xx4=$zigzagidx[t-1]
    yy4=$zigzag[t-1]
    //xx5=$zigzagidx[t]
    //yy5=$zigzag[t]
    dist1=abs(yy3-min(yy2,yy4))
    if Show2Bot then
    //drawrectangle(xx2,yy2,xx4,yy4)coloured("green")fillcolor("green",50)
    Box = 1
    endif
    endif
    if checkbot and ShowLong then
    if not long and close crosses over yy3 then
    long=1
    tp=yy3+dist1
    sl=min(yy2,yy4)
    //drawarrowup(barindex,low)coloured("green")
    //drawsegment(xx3,yy3,barindex,yy3)coloured("blue")
    endif
    if long and high crosses over tp then
    long=0
    checkBot=0
    //Drawsegment(xx3,tp,barindex,tp)coloured("blue")style(dottedline)
    //drawarrowdown(barindex,high)coloured("red")
    endif
    if long and close crosses under sl then
    checkBot=0
    long=0
    //Drawsegment(xx4,sl,barindex,sl)coloured("blue")style(dottedline)
    //drawarrowdown(barindex,high)coloured("red")
    endif
    endif
    endif
    //—-Draw Pivots——————————————//
    if islastbarupdate  and showPivot then
    for i=t downto 4 do
    //drawpoint($zigzagidx[i],$zigzag[i],2)coloured("blue",100)
    next
    endif
    //———————————————————-//
    SCREENER[Box AND (high <> low)](Box AS "1=Green, 2=Red")
    NicoGB67 and Iván González thanked this post
    #254558 quote
    NicoGB67
    Participant
    New

    Buenos días, gracias Roberto, entiendo que el repintado es debido a que el soporte o techo aparece un par de barras después dado que es cuando se confirma dicho techo o suelo, saludos.

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

Doble techo, doble suelo


Soporte ProScreener

New Reply
Author
author-avatar
NicoGB67 @nicogb67 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by NicoGB67
1 month, 2 weeks ago.

Topic Details
Forum: Soporte ProScreener
Language: Spanish
Started: 12/13/2025
Status: Active
Attachments: No files
Logo Logo
Loading...