modiication taille rectangle dans indicateur fvg

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

    bonjour,

    je souhaiterais avoir les rectangles fvg (bleu et rose) qui se mettent à l’infini sur la droite.

    pouvez vous me dire ce que je dois modifier ?

    d’avance un grand merci.

    ci dessous le programme que j’ai utilisé :

    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
    // Author: toniyecla
    // FVG (Fair Value Gap / Imbalances)
    rango = 5
    alcista = close[2] > open[2]
    if (alcista) then
    maximo = low[1]
    minimo = high[3]
    if (maximominimo > rango) then
    drawrectangle(barindex[2], maximo, barindex + 1, minimo) coloured (0,157,157,32) bordercolor (0,153,153,0)
    drawsegment(barindex[2], maximo (maximo minimo) / 2, barindex + 1, maximo (maximo minimo) / 2) coloured (255,255,255,64)
    drawsegment(barindex[2], maximo (maximo minimo) / 4, barindex + 1, maximo (maximo minimo) / 4) coloured (255,255,255,64)
    drawsegment(barindex[2], minimo + (maximo minimo) / 4, barindex + 1, minimo + (maximo minimo) / 4) coloured (255,255,255,64)
    endif
    else
    maximo = low[3]
    minimo = high[1]
    if (maximominimo > rango) then
    drawrectangle(barindex[2], maximo, barindex + 1, minimo) coloured (255,0,0,32) bordercolor (255,102,102,0)
    drawsegment(barindex[2], maximo (maximo minimo) / 2, barindex + 1, maximo (maximo minimo) / 2) coloured (255,255,255,64)
    drawsegment(barindex[2], maximo (maximo minimo) / 4, barindex + 1, maximo (maximo minimo) / 4) coloured (255,255,255,64)
    drawsegment(barindex[2], minimo + (maximo minimo) / 4, barindex + 1, minimo + (maximo minimo) / 4) coloured (255,255,255,64)
    endif
    endif
    return
    #244891 quote
    larouedegann
    Participant
    Master
    DEFPARAM DrawOnLastBarOnly = true
    DEBUG = 0
     
    // Start of code, don't change anything below
     
    IF IsLastBarUpdate THEN
    $RangeHigh[0] = 0
    $RangeLow[0] = 0
    $RangeIndex[0] = 0
    RangeIdx = 0
    BI = 0
    B = 0
    RI = 0
    TotalBars = BarIndex[0]
     
    IF DEBUG = 1 THEN
    DRAWTEXT("Total bars: #TotalBars#", BarIndex[0], High[0])
    ENDIF
     
    // List all imbalance
    FOR RI = 1 TO TotalBars - 2 DO
    BI = BarIndex[RI]
    //drawtext("#BI#", BI, High[RI])
    IF High[BI - 1] < Low[BI + 1] THEN
    RangeIdx = RangeIdx + 1
    $RangeHigh[RangeIdx] = Low[BI + 1]
    $RangeLow[RangeIdx] = High[BI - 1]
    $RangeIndex[RangeIdx] = RI
    ENDIF
    IF High[BI + 1] < Low[BI - 1] THEN
    RangeIdx = RangeIdx + 1
    $RangeHigh[RangeIdx] = Low[BI - 1]
    $RangeLow[RangeIdx] = High[BI + 1]
    $RangeIndex[RangeIdx] = RI
    ENDIF
    NEXT
     
    IF DEBUG = 1 THEN
    DRAWTEXT("Imbalance found: #RangeIdx#", BarIndex[0], Low[0])
    ENDIF
     
    // Remove mitigated imbalance
    FOR RI = 1 TO RangeIdx DO
    IF DEBUG = 1 THEN
    DRAWRECTANGLE($RangeIndex[RI] - 1, $RangeHigh[RI], $RangeIndex[RI] + 1, $RangeLow[RI]) COLOURED("yellow",150)
    ENDIF
     
    Valid = 1
    FOR B = $RangeIndex[RI] + 2 TO TotalBars DO
    LB = Low[BarIndex[B]]
    HB = High[BarIndex[B]]
    // Candle is above or below our zone, ignore it
    IF LB >= $RangeHigh[RI] OR HB <= $RangeLow[RI] THEN
    IF DEBUG = 1 THEN
    DRAWTEXT("Out", B, High[BarIndex[B]])
    ENDIF
    CONTINUE
    ENDIF
     
    IF LB <= $RangeLow[RI] THEN
    // Candle engulfs our zone, so imbalance is mitigated
    IF HB >= $RangeHigh[RI] THEN
    IF DEBUG = 1 THEN
    DRAWTEXT("Mitigated", B, High[BarIndex[B]])
    ENDIF
    Valid = 0
    BREAK
    ENDIF
    IF DEBUG = 1 THEN
    DRAWTEXT("High", B, High[BarIndex[B]])
    ENDIF
    $RangeLow[RI] = HB
    ELSE
    // In this case, Low is within the zone
    IF DEBUG = 1 THEN
    DRAWTEXT("Low", B, High[BarIndex[B]])
    ENDIF
    $RangeHigh[RI] = LB
    ENDIF
    NEXT
    IF Valid = 1 THEN
    DRAWRECTANGLE($RangeIndex[RI], $RangeHigh[RI], TotalBars+2000, $RangeLow[RI]) COLOURED(0,0,0,0) FILLCOLOR("yellow",150)
    ENDIF
     
    NEXT
     
    ENDIF
     
    RETURN
    #244900 quote
    Iván González
    Moderator
    Master

    Bonjour. Si vous souhaitez étendre les rectangles du premier code vers le futur, il vous suffit de modifier les instructions de dessin. Je vais vous donner un exemple (voir capture d'écran). L'instruction barindex+ barindex + 1 est ce qui fait que le rectangle s'étend vers la droite d'une barre ou de barindex + 2000 .

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

modiication taille rectangle dans indicateur fvg


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
yann31660 @yann31660 Participant
Summary

This topic contains 2 replies,
has 3 voices, and was last updated by Iván González
10 months, 4 weeks ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 03/12/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...