Absorption via OBV On Balance Volume

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #228038 quote
    Alai-n
    Participant
    Veteran

    Bonjour, je tente en vain de matérialiser une Absorption via l’OBV…

    Pour se faire j’ai repris une formulation existante sur ProRealCode mettant en avant des divergences sur Macd. J’ai juste remplacé le Macd par l’OBV et inversé qques signes afin de mettre en évidence une Absorption comme sur l’image jointe.

    Jusque là rien n’avait l’air compliqué, cependant je n’arrive pas à afficher quoique ce soit, ni sur le prix, ni dans une fenêtre sous le prix! Il est évident que je passe à côté d’un détail qui doit faire la différence.

    Un coup de pouce serait appréciable, merci.

    //"OBV on Price"
    
    N      = 40                      //N is the number of bars to look back for...
    
    ObvAbsorption = 0
    
    //Obv | Indicator
    
    MiOBV  = OBV(close)
    Offset = highest[N](range) * 0.2
    
    //
    
    IF (BarIndex > 1+1+N) THEN
    //Absorption Haussière
    IF (miOBV > miOBV[1] AND miOBV[1] < miOBV[2]) THEN
    extremum22=miOBV[1]
    extremum11=lowest[N](miOBV)
    preciomin2=close[1]
    preciomin=lowest[N](close)
    IF(extremum22<extremum11 AND preciomin2>=preciomin[1]) THEN
    for i=1 to N
    if close[i]=preciomin[1] then
    zz=i
    drawsegment(barindex[1], close[1]-Offset, barindex[zz], close[zz]-Offset) coloured(0,200,0)
    ObvAbsorption = 1
    endif
    next
    endif
    endif
    
    Return extremum22 as "extremum22", extremum11 as "extremum11", preciomin as "preciomin", preciomin2 as "preciomin2"
    #228042 quote
    JC_Bywan
    Moderator
    Master

    Bonjour,

    à la lecture du code, sans préjuger de si remplacer un cumulative volume delta (le cvd de l’image) par un obv peut marcher ou pas, quelques remarques sans que ce soit exhaustif, mais a minima des choses à revoir avant d’éventuellement débugguer davantage dans la foulée de leur résolution:

    1. prendre les lowest sur N ne définira pas forcément un extremum plus ancien car ça définit aussi le cas du premier point d’une série de N dans l’ordre chronologique étant juste un point au milieu d’une montée continue (puisqu’on ne regarde pas les points avant lui), on ne peut pas faire l’économie de vraiment définir cet extremum précédent comme on définit l’extremum qui vient de se produire sur le trio [2] [1] [0]
    2. de plus si l’extremum précédent pour ton obv est voulu comme plus bas PLUS HAUT que sur le trio [2] [1] [0], alors le définir comme un LOWEST parmi N est une contradiction d’emblée qui ne donnera jamais un cas qui marche dans les if
    3. le for i=1 to N va créer une comparaison close[i]=preciomin[1] ( de [“un”]) quand i=1, donc un retour vrai à chaque fois si les points précédents résolus, pas grave dans la mesure où ça tracerait un point plutôt qu’un segment, mais sans doute qu’un for i=2 to N serait plus approprié si on tient à garder une recherche en arrière sur N
    Alai-n thanked this post
    #228046 quote
    jacquesgermain
    Participant
    Senior

    Bonjour celui ci donne le résultat recherché

     

    Defparam CALCULATEONLASTBARS=300

    N=40
    if close>open then
    newclose=close
    newopen=open
    endif
    if close<= open then
    newclose=open
    newopen=close
    endif
    ///N is the number of bars to look back for a divergence. Normal values are 20-40. Must be the same in both indicators
    miobv=OBV(close)//RSI[per](close)
    IF (miobv[1]<miobv AND miobv[1]<miobv[2]) THEN
    obvextremC2=miobv[1]
    obvextremC1=lowest[N](miobv)
    obvpminC2=close[1]
    obvpminC=Lowest[N](close)
    IF(obvextremC2=obvextremC1 AND obvpminC2>obvpminC[1]) THEN
    for obvl=1 to N
    if close[obvl]=obvpminC[1] and cache then
    obvzzmC=obvl
    DRAWTEXT(“c”,barindex[1], miobv[1],dialog,bold,10)coloured(0,0,180)
    drawsegment (barindex[1], miobv[1], barindex[obvzzmC],miobv[obvzzmC]) coloured(150,0,0)style(line,1)
    endif
    next
    endif
    endif

    return miobv as “monOBV”

    Alai-n thanked this post
    #228063 quote
    Alai-n
    Participant
    Veteran

    @JC_Bywan, merci pour tes indications et tes observations…

    J’ai repris une autre piste et j’ai pu sortir ces deux codes permettant de mettre en évidences les Absorptions sur l’OBV et le CVD(Cumulative Volume Delta). Je les mets ici, au cas ou cela intéresserait des membres de la communauté ProRealCode!

    // "Obv Absorption"
    
    //
    //Variables :
    //
    MinBarRange = 1
    Rge         = Averagetruerange[10](close)
    MiOBV       = OBV(close)
    //
    Once ShiftText = 3
    //
    OBVMax = MiOBV < MiOBV[1] and MiOBV[1] > MiOBV[2]
    OBVMin = MiOBV > MiOBV[1] and MiOBV[1] < MiOBV[2]
    //
    
    //Absorption des Vendeurs agressifs = signal haussier
    If OBVMin then
    OBVMin1 = MiOBV[1]
    Low1 = Low[1]
    
    for I = MinBarRange to 40
    If OBVMin[I] then
    OBVMin2 = MiOBV[I+1]
    Low2 = Low[I+1]
    If Low1 >= Low2 and OBVMin1 < OBVMin2 then
    Drawarrowup(barindex, Low - Rge / ShiftText)coloured("green")
    Drawtext("Absorption", barindex, Low - Rge / ShiftText / 0.2, SansSerif, Italic, 10)coloured("green")
    Drawsegment (barindex[I], low[I], barindex, low) coloured("green")
    endif
    break
    endif
    next
    endif
    
    //Absorption des Acheteurs agressifs = signal baissier
    If OBVMax then
    OBVMax1 = MiOBV[1]
    High1 = High[1]
    
    for I = MinBarRange to 40
    If OBVMax[I] then
    OBVMax2 = MiOBV[I+1]
    High2 = High[I+1]
    If High1 <= High2 and OBVMax1 > OBVMax2 then
    Drawarrowdown(barindex, High + Rge / ShiftText)coloured("red")
    Drawtext("Absorption", barindex, High + Rge / ShiftText / 0.2, SansSerif, Italic, 10)coloured("red")
    Drawsegment (barindex[I], high[I], barindex, high) coloured("red")
    endif
    break
    endif
    next
    endif
    
    
    Return
    // "Cumulative Volume Delta Absorption"
    
    //"Cumulative Delta" (by Nicolas/ProRealcode)
    ////////////////////////////////////////////////////////////////////
    //U1
    if(close>=open and (close-open+2*(high-close)+2*(open-low)))>0 then
    U1= volume*(high-low)/(close-open+2*(high-close)+2*(open-low))
    else
    U1=0.0
    endif
    //D1
    if(close<open and (open-close+2*(high-open)+2*(close-low)))>0 then
    D1 = volume*(high-low)/(open-close+2*(high-open)+2*(close-low))
    else
    D1=0.0
    endif
    ////////////////////////////////////////////////////////////////////
    //Delta
    if(close>=open) then
    Delta= U1
    else
    Delta= -D1
    endif
    ////////////////////////////////////////////////////////////////////
    if barindex>1 then
    cumDelta=(cumDelta[1])+Delta
    
    if close>=open then
    hi= cumDelta
    else
    hi =cumDelta[1]
    endif
    if close<=open then
    lo= cumDelta
    else
    lo=cumDelta[1]
    endif
    //drawcandle(cumDelta[1], hi, lo, cumDelta)
    endif
    
    //
    //Variables :
    //
    MinBarRange = 1
    Rge         = Averagetruerange[10](close)
    //
    Once ShiftText = 3
    //
    CVDMax = cumDelta < cumDelta[1] and cumDelta[1] > cumDelta[2]
    CVDMin = cumDelta > cumDelta[1] and cumDelta[1] < cumDelta[2]
    //
    
    //Absorption des Vendeurs agressifs = signal haussier
    If CVDMin then
    CVDMin1 = cumDelta[1]
    Low1 = Low[1]
    
    for I = MinBarRange to 40
    If CVDMin[I] then
    CVDMin2 = cumDelta[I+1]
    Low2 = Low[I+1]
    If Low1 >= Low2 and CVDMin1 < CVDMin2 then
    Drawarrowup(barindex, Low - Rge / ShiftText)coloured("green")
    Drawtext("Absorption", barindex, Low - Rge / ShiftText / 0.2, SansSerif, Italic, 10)coloured("green")
    Drawsegment (barindex[I], low[I], barindex, low) coloured("green")
    endif
    break
    endif
    next
    endif
    
    //Absorption des Acheteurs agressifs = signal baissier
    If CVDMax then
    CVDMax1 = cumDelta[1]
    High1 = High[1]
    
    for I = MinBarRange to 40
    If CVDMax[I] then
    CVDMax2 = cumDelta[I+1]
    High2 = High[I+1]
    If High1 <= High2 and CVDMax1 > CVDMax2 then
    Drawarrowdown(barindex, High + Rge / ShiftText)coloured("red")
    Drawtext("Absorption", barindex, High + Rge / ShiftText / 0.2, SansSerif, Italic, 10)coloured("red")
    Drawsegment (barindex[I], high[I], barindex, high) coloured("red")
    endif
    break
    endif
    next
    endif
    
    
    Return

     

    Bon après-midi

    jacquesgermain and JC_Bywan thanked this post
    #230925 quote
    JC_Bywan
    Moderator
    Master

    Merci

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

Absorption via OBV On Balance Volume


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Alai-n @alai-n Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by JC_Bywan
1 year, 10 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 02/13/2024
Status: Active
Attachments: 2 files
Logo Logo
Loading...