IMBALANCE projections rectangulaires

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #222142 quote
    larouedegann
    Participant
    Master

    Bonjour toute le monde,

    Je lance un topic de continuation concernant les imbalances sur un sujet déjà lançé par michel et suivi par nicolas

    à cette adresse : https://www.prorealcode.com/topic/fin-conditionnelle-de-trace-dun-rectangle/

    Personnellement, j’utilise les imbalances dans un code qui permet de dessiner un chandelier, mais je suis obligé de dessiner le rectangle

    manuellement: soit qu’il a été grignoté, soit qu’il a été couvert, soit qu’il n’a pas été touché.

    TopImbalance = high<low[2]
    if TopImbalance  then
    drawcandle(low[2], low[2], high[0], high[0]) coloured("yellow")
    endif
    BottomInbalance = high[2]<low
    if BottomInbalance then
    drawcandle(low[0], low[0], high[2], high[2]) coloured ("yellow")
    endif
    return

    Pourquoi ne pas le faire en automatique ?

    Grace au topic sus-cité on a un début de réponse prometteur .

    ci dessous le code du topic

    REM Store support
    IF high[2] < low THEN
    $support[i]= high[2]
    $bar[i]=barindex
    i=i+1
    ENDIF
     
    REM check support line
    if islastbarupdate and i>1 then
    for j = 0 to i-1
    checklow = $support[j]
    bars = max(1,barindex-$bar[j])
    endbar=barindex
    for z = 1 to bars
    if low[z]<checklow then
    endbar=barindex[z]
    endif
    next
    if endbar<barindex then
    drawrectangle($bar[j]-2,low[max(0,barindex-$bar[j])],endbar,$support[j]) coloured("yellow") bordercolor(0,0,0,0)
    ELSE
    drawrectangle($bar[j]-2,low[max(0,barindex-$bar[j])],barindex,$support[j]) coloured("yellow") bordercolor(0,0,0,0)
    endif
    next
    endif
     
    RETURN

    il ne reste pas grand chose pour qu’il soit parfait.

    1/il n’y a que des bottom imbalances ( high[2]<low) donc manque les top imbalances  (high<low[2])

    2/ et c’est là que cela devient intéressant réduire le grignotage du rectangle (ou pas) au fur et à mesure du temps.

    voir exemple.

    Merci de votre aide pour enfin finir ce sujet.

    BUNDXXXX-30-minutes.png BUNDXXXX-30-minutes.png
    #222239 quote
    Nicolas
    Keymaster
    Master

    Je pense avoir compris, mais ..

    Faut il simplement utiliser ma version pour les bottom et l’adapter pour les top (high<low[2]) ?

    #222253 quote
    larouedegann
    Participant
    Master

    Bonjour Nicolas,

    Oui c’est cela même , d’avoir les tops et bottoms imbalances (rectangles) sur le même graphique.

    Et si c’est possible  réduire le grignotage du rectangle (ou pas) au fur et à mesure des chandeliers qui se dessinent .

    Peut être au niveau du controle de la boucle en redessinant un nouveau rectangle ??? (voir fichier au dessus)

    #222261 quote
    Nicolas
    Keymaster
    Master

    Il faudrait tester avec le code ci-dessous, je n’ai pas modifié le comportement de tracement des rectangles, il faut bien comprendre qu’on ne les trace qu’une seule fois dans le passé, depuis la barre courante.

    Peut être que l’on pourrait les tracer plusieurs fois avec un niveau de transparence de plus en plus élevé, à la file .. à étudier 🙄

    defparam drawonlastbaronly=true
    
    REM Store support
    IF high[2] < low THEN
    $support[i]= high[2]
    $bar[i]=barindex
    i=i+1
    ENDIF
    
    REM Store resistance 
    if high<low[2] then 
    $res[y]= low[2]
    $resbar[y]=barindex
    y=y+1
    endif 
    
    REM check support line
    if islastbarupdate and i>1 then
    for j = 0 to i-1
    checklow = $support[j]
    bars = max(1,barindex-$bar[j])
    endbar=barindex
    for z = 1 to bars
    if low[z]<checklow then
    endbar=barindex[z]
    endif
    next
    if endbar<barindex then
    drawrectangle($bar[j]-2,low[max(0,barindex-$bar[j])],endbar,$support[j]) coloured("yellow",50) bordercolor(0,0,0,0)
    ELSE
    drawrectangle($bar[j]-2,low[max(0,barindex-$bar[j])],barindex,$support[j]) coloured("yellow",50) bordercolor(0,0,0,0)
    endif
    next
    endif
    
    REM check resistance line
    if islastbarupdate and y>1 then
    for j = 0 to y-1
    checkhigh = $res[j]
    bars = max(1,barindex-$resbar[j])
    endbar=barindex
    for z = 1 to bars
    if high[z]>checkhigh then
    endbar=barindex[z]
    endif
    next
    if endbar<barindex then
    drawrectangle($resbar[j]-2,high[max(0,barindex-$resbar[j])],endbar,$res[j]) coloured("cyan",50) bordercolor(0,0,0,0)
    ELSE
    drawrectangle($resbar[j]-2,high[max(0,barindex-$resbar[j])],barindex,$res[j]) coloured("cyan",50) bordercolor(0,0,0,0)
    endif
    next
    endif
    
    RETURN
    imbalance-zones.png imbalance-zones.png
    #222293 quote
    larouedegann
    Participant
    Master

    J’ai un message d’erreur

    Détection d’une boucle sans fin ou avec trop d’itérations

    #222300 quote
    larouedegann
    Participant
    Master

    OK trop d’unités dans le graphique   3000 unités passent,      pas 4000 . Je suis en en 1 mn.

    Il faudrait le publier, c ‘est un très bon indicateur sur prix.

    Merci

    #222318 quote
    Nicolas
    Keymaster
    Master

    J’ai recodé une version optimisé pour éviter les problèmes de boucles infinis, je vais la poster dans la library dés que possible.

    #222333 quote
    Nicolas
    Keymaster
    Master

    J’ai posté l’indicateur de Imbalances ici : Imbalances indicator

    imbalances-indicator-NQ.png imbalances-indicator-NQ.png
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

IMBALANCE projections rectangulaires


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
Summary

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

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 10/07/2023
Status: Active
Attachments: 3 files
Logo Logo
Loading...