Historique des prix, combien de fois le prix a t’il coupé un niveau ?

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
    Posts
  • #193816 quote
    BenCD
    Participant
    Average

    Première remarque, en faisant un return de “MaxTouch2” j’arrive à avoir le niveau (prix) du ‘touch’ le plus grand, mais uniquement à partir du moment ou je ‘valide’ le code.

    Je n’ai pas ‘avant’, est se lié à “IsLastBarUpdate”?

    C’est bon, j’ai trouvé la parade, si j’enlève IsLastBarUpdate plus gourmand en chargement et calcul, mais cela fonctionne.

    #202804 quote
    BenCD
    Participant
    Average

    Bonjour Nicolas,

    Je me permets de revenir vers toi concernant ce code que tu m’as déjà aidé à construire (une nouvelle fois, merci).

    Toujours dans la volonté de visualiser les niveaux de prix les plus “croisés” j’ai un peu continué à creuser mais, je tombe de nouveau sur un os!

    Le code comptabilise correctement le nombre de fois que le “cours” croise un niveau de prix, mais je souhaite (dans un premier temps) récupérer le niveau ou le nombre de croisements est le plus grand.
    J’ai donc essayé d’utiliser “ArrayMax”.
    Mais je doute que cela soit la bonne technique (ou bien je ne le fais pas correctement) car lorsque que je lui demande de tirer une demie droite, je ne parvient pas à l’avoir au bon niveau.

    Aurais tu un conseil pour m’orienter dans la bonne direction?
    Également, une idée de comment gérer les “doublons”, lorsque plusieurs niveaux de prix ont été croisés le même nombre de fois?

    Par la suite, idéalement, j’aimerais avoir une demie droite dessinée sur les 2, 3, 4… X plus grands nombres de croisements.
    Même si je sais déjà que je vais devoir démêler le problème que pour une certaine zone de prix, “20” croisements c’est beaucoup et un niveau sur lequel il faut une demie droite, mais dans une autre zone de prix, “20” ne sera pas du tout pertinent…

    Un immense merci à toi,
    N’hésite pas à me dire si je n’ai pas été clair et que mon message manque de sens.

    (PS : Je suis sur le S&P en 1min)

    /////

    Le code :

     

    defparam drawonlastbaronly = true
    
    //_________________________________________________________ TIMING
    
    Heures = Hour
    Miinutes = Minute
    Secondes = Second
    
    HeureDebutChandelle = HeureFinChandelle[1]
    
    HeureFinChandelle = Hour * 10000 + Miinutes * 100 + Secondes
    
    if HeureFinChandelle < HeureFinChandelle[1] then
    HeureDebutChandelle = 0
    endif
    
    //______________________________________________ NOMBRE CHANDELLES
    
    NombreChandelles = 1
    
    if HeureDebutChandelle > HeureDebutChandelle[1] then
    NombreChandelles = NombreChandelles[1] + 1
    endif
    
    //__________________________________________________ INFOS JOURNEE
    
    if NombreChandelles < NombreChandelles[1] then
    DebutJournee = barindex
    OuvertureJournee = open
    PlusBasJournee = Low
    PlusHautJournee = High
    endif
    
    if Low <= PlusBasJournee then
    PlusBasJournee = Low
    endif
    
    if Low > PlusBasJournee then
    PlusBasJournee = PlusBasJournee[1]
    endif
    
    if High >= PlusHautJournee then
    PlusHautJournee = High
    endif
    
    if High < PlusHautJournee then
    PlusHautJournee = PlusHautJournee[1]
    endif
    
    //__________________________________________________
    
    PrixTest = PlusBasJournee
    
    if islastbarupdate then
    while PrixTest <= PlusHautJournee do
    Touch = 0
    for i = 0 to NombreChandelles do
    if High[i] >= PrixTest and Low[i] <= PrixTest then
    Touch=Touch + 1
    $Touch[i] = Touch
    r = min($Touch[i]*10,255)
    $Price[Touch]=PrixTest
    endif
    next
    drawtext("#Touch#",barindex+10,PrixTest,SansSerif,Standard,10) coloured (255,255,255)
    drawtext("#PrixTest#",barindex+20,PrixTest,SansSerif,Standard,10) coloured (255,255,255)
    drawtext("█",barindex+5,PrixTest) coloured(r,0,0)
    PrixTest = PrixTest + 0.25
    MaxTouch = arraymax($Touch)
    PrixMaxTouch = $Price[MaxTouch]
    wend
    drawray (barindex[NombreChandelles], PrixMaxTouch, barindex, PrixMaxTouch)
    endif
    
    //__________________________________________________
    
    return
    Capture-decran-2022-10-19-a-06.01.06.png Capture-decran-2022-10-19-a-06.01.06.png
    #202806 quote
    BenCD
    Participant
    Average

    (Toujours impossible d’insérer un code PRT, est se lié au fait que je sois sur Safari?)

    #202817 quote
    Nicolas
    Keymaster
    Master

    Tu utilises mal ArrayMax. Cela va te donner la valeur maximale stocké dans l’array mais pas le numéro de la colonne.

    Bref, j’ai fait plus simple avec une simple condition pour tester si la quantité de touch est supérieure à celle stocké et si oui alors on récupère la valeur du prix.

    defparam drawonlastbaronly = true
    
    //_________________________________________________________ TIMING
    
    Heures = Hour
    Miinutes = Minute
    Secondes = Second
    
    HeureDebutChandelle = HeureFinChandelle[1]
    
    HeureFinChandelle = Hour * 10000 + Miinutes * 100 + Secondes
    
    if HeureFinChandelle < HeureFinChandelle[1] then
    HeureDebutChandelle = 0
    endif
    
    //______________________________________________ NOMBRE CHANDELLES
    
    NombreChandelles = 1
    
    if HeureDebutChandelle > HeureDebutChandelle[1] then
    NombreChandelles = NombreChandelles[1] + 1
    endif
    
    //__________________________________________________ INFOS JOURNEE
    
    if NombreChandelles < NombreChandelles[1] then
    DebutJournee = barindex
    OuvertureJournee = open
    PlusBasJournee = Low
    PlusHautJournee = High
    endif
    
    if Low <= PlusBasJournee then
    PlusBasJournee = Low
    endif
    
    if Low > PlusBasJournee then
    PlusBasJournee = PlusBasJournee[1]
    endif
    
    if High >= PlusHautJournee then
    PlusHautJournee = High
    endif
    
    if High < PlusHautJournee then
    PlusHautJournee = PlusHautJournee[1]
    endif
    
    //__________________________________________________
    
    PrixTest = PlusBasJournee
    
    if islastbarupdate then
    while PrixTest <= PlusHautJournee do
    Touch = 0
    //prixmaxtouch = 0
    for i = 0 to NombreChandelles do
    if High[i] >= PrixTest and Low[i] <= PrixTest then
    Touch=Touch + 1
    $Touch[i] = Touch
    r = min($Touch[i]*10,255)
    if touch>previoustouch then 
    previoustouch=touch
    prixmaxtouch=PrixTest
    endif
    endif
    next
    drawtext("#Touch#",barindex+10,PrixTest,SansSerif,Standard,10) //coloured (255,255,255)
    drawtext("#PrixTest#",barindex+20,PrixTest,SansSerif,Standard,10) //coloured (255,255,255)
    drawtext("█",barindex+5,PrixTest) coloured(r,0,0)
    PrixTest = PrixTest + 0.25
    wend
    
    drawray (barindex[NombreChandelles], PrixMaxTouch, barindex, PrixMaxTouch)
    endif
    
    //__________________________________________________
    
    return
    sharteel thanked this post
    #202818 quote
    BenCD
    Participant
    Average

    Merci beaucoup pour ton retour Nicolas!

    Effectivement j’avais vu que ArrayMax n’était pas bon dans mon utilisation!
    Merci pour ton éclaircissement!

    Je regarde en détails dès que possible!
    Et je me permettrai de revenir vers toi si besoin concernant la possibilité de faire la même chose mais avec les 2/3/…/x valeurs de touch les plus grandes!

    Un immense merci!

    #206391 quote
    sharteel
    Participant
    Junior

    bonjour a tous,

    super intéressant comme script.

     

    comment pourrait on le modifier pour ajouter cette indicateur barre sur les 5 derniers jours et périodes semaine / mois ?

    bonnes fetes 🙂

    ++

Viewing 6 posts - 16 through 21 (of 21 total)
  • You must be logged in to reply to this topic.

Historique des prix, combien de fois le prix a t’il coupé un niveau ?


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
BenCD @bencd Participant
Summary

This topic contains 20 replies,
has 4 voices, and was last updated by sharteel
3 years, 2 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 12/13/2021
Status: Active
Attachments: 3 files
Logo Logo
Loading...