Codage intraDay: Indicateur visible only jour en cours

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #192643 quote
    christophe11560
    Participant
    Senior

    Bonjour à toute la communauté,
    j’ai crée un indicateur pour une utilisation intraday.
    Au lieu d’utiliser la fonction “defparam calculateonlastbars = 80” je souhaiterai que mon indicateur n’apparaisse que le jour en cours.
    En effet, il prend trop de place à l’écran lorsque je change d’unité de temps.
    Je vous joint une photographie de mon problème.

    MERCI!
    christophe

    #192647 quote
    Nicolas
    Keymaster
    Master

    La copie d’écran n’est pas passé ?

    Voici une condition pour tester si on est dans le dernier jour affiché:

    if intradaybarindex=0 then 
     daytime = opentimestamp
    endif 
    
    if timestamp>=daytime then 
     //placer ici le code de ton indicateur ou de ce que tu dois afficher 
    endif 
    
    
    #192651 quote
    Nicolas
    Keymaster
    Master

    Désolé la solution ci-dessus ne fonctionne que si on trace dans le passé à partir de la bougie courante, donc pas forcément adapté à chaque code d’indicateur. Je réfléchis à une autre solution..

    #192689 quote
    christophe11560
    Participant
    Senior

    POUR INFORMATION IMAGE ET MERCI DE CHERCHER UNE SOLUTION A MON PROBLEME

    CHRISTOPHE

    7adGaNX3Ng.jpg 7adGaNX3Ng.jpg
    #192698 quote
    christophe11560
    Participant
    Senior
    #192718 quote
    Nicolas
    Keymaster
    Master

    Pour référence, je pose le code original ici:

    defparam calculateonlastbars = 80
    ALPHAfond=50
    AlphaPivotsIntermediaires=50
    AlphaPivotsPrincipaux=50
    
    if opentime=153000 then
    drawvline(barindex) style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=153500 then
    drawvline(barindex) style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=155000 then
    drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if opentime=161000 then
    drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if opentime=162500 then
    drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=163500 then
    drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=171500 then
    drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if opentime=180000 then
    drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=184500 then
    drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=193000 then
    drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if opentime=201500 then
    drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if opentime=210000 then
    drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if opentime=213000 then
    drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=220000 then
    drawvline(barindex) style (DOTTEDline,2) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime >= 162500 AND opentime =< 163500 then
    backgroundcolor(0,204,102,ALPHAfond)
    endif
    if opentime >= 155000 AND opentime =< 161000 then
    backgroundcolor(0,204,102,ALPHAfond)
    endif
    if opentime >= 180000 AND opentime =< 180500 then
    backgroundcolor(0,204,102,ALPHAfond)
    endif
    if opentime >= 193000 AND opentime =< 193500 then
    backgroundcolor(0,204,102,ALPHAfond)
    endif
    RETURN
    

    Il n’y a pas de solution “fiable” pour savoir si la bougie courante est contenu sur le graphique d”aujourd’hui”.

    La solution adapté à ton code, c’est de tout recoder en enregistrant toutes les informations des chandeliers où il faut tracer les lignes, et ne les tracer qu’une seule fois lors de la lecture de la bougie courante. Voir mon prochain post.

    #192719 quote
    Nicolas
    Keymaster
    Master

    Ci-joint la version modifiée pour afficher uniquement les lignes et les fonds sur la journée courante.

    defparam drawonlastbaronly=true
    
    ALPHAfond=50
    AlphaPivotsIntermediaires=50
    AlphaPivotsPrincipaux=50
    
    if intradaybarindex=0 or day<>day[1] then
    todaybar=barindex
    endif
    
    if opentime=153000 then
    $pivoti[0] = barindex
    //drawvline(barindex) style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=153500 then
    $pivoti[1] = barindex
    //drawvline(barindex) style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=162500 then
    $pivoti[2] = barindex
    //drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=163500 then
    $pivoti[3] = barindex
    //drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=180000 then
    $pivoti[4] = barindex
    //drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=184500 then
    $pivoti[5] = barindex
    //drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=213000 then
    $pivoti[6] = barindex
    //drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if opentime=220000 then
    $pivoti[7] = barindex
    //drawvline(barindex) style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    // --------
    if opentime=155000 then
    $pivotp[0] = barindex
    //drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if opentime=161000 then
    $pivotp[1] = barindex
    //drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if opentime=171500 then
    $pivotp[2] = barindex
    //drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if opentime=193000 then
    $pivotp[3] = barindex
    //drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if opentime=201500 then
    $pivotp[4] = barindex
    //drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if opentime=210000 then
    $pivotp[5] = barindex
    //drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    // --------
    c1= opentime >= 162500 AND opentime =< 163500
    if c1 and not c1[1] then
    $start[0]=barindex
    elsif not c1 and c1[1] then
    $end[0]=barindex
    endif
    c2= opentime >= 155000 AND opentime =< 161000
    if c2 and not c2[1] then
    $start[1]=barindex
    elsif not c2 and c2[1] then
    $end[1]=barindex
    endif
    c3= opentime >= 180000 AND opentime =< 180500
    if c3 and not c3[1] then
    $start[2]=barindex
    elsif not c3 and c3[1] then
    $end[2]=barindex
    endif
    c4= opentime >= 193000 AND opentime =< 193500
    if c4 and not c4[1] then
    $start[3]=barindex
    elsif not c4 and c4[1] then
    $end[3]=barindex
    endif
    
    // --------
    if islastbarupdate then
    for i = 0 to 7 do
    //lignes
    if $pivoti[i]>todaybar then
    drawvline($pivoti[i])style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)
    endif
    if isset($pivotp[i]) and $pivotp[i]>todaybar then
    drawvline($pivotp[i])style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)
    endif
    if isset($start[i]) and $start[i]>todaybar then
    //fond
    drawrectangle($start[i],0,$end[i],close*100) coloured(0,204,102,ALPHAfond) bordercolor(0,0,0,0)
    endif
    next
    endif
    
    RETURN
    #192820 quote
    christophe11560
    Participant
    Senior

    Bonjour,
    Je te joins une image de l’indicateur que tu m’as proposé, appelé “nouvel indicateur”
    Et une image de mon indicateur de base appelé “ancien indicateur”
    Tu pourras remarquer que celui-ci est présent sur plusieurs journée et il manque des lignes verticales, etc? je ne sais pas pourquoi.

    Dans l’attente de te lire.

    nouvel-indicateur.jpg nouvel-indicateur.jpg ancien-indicateur.jpg ancien-indicateur.jpg
    #192935 quote
    Nicolas
    Keymaster
    Master

    C’est très curieux, je ne reproduis pas, et il y a des choses anormales sur ton graphique.

    1. Dans ta version “ancien indicateur”, il y a plus de 4 fonds colorés dans la même journée, alors qu’il y en a bien que 4 dans le code que tu as fournis.
    2. Dans la copie d’écran “nouvel indicateur”, il ne peut pas y avoir de jours précédents colorés, car on utilise toujours la dernière valeur, celle du jour, et il n’y a pas plus de 4 valeurs de fonds différentes stockés dans les variables.

    Ce qui me fait dire que tu as fait un mauvais copier/coller ou mélanger les versions.

    L’idéal serait de créer un graphique sans aucun autre indicateur que celui avec le code posté juste avant, afin de bien comprendre, merci.

    #192968 quote
    christophe11560
    Participant
    Senior

    bonjour nicolas,
    ci-joint copie écran.
    graphique vierge avec seulement ton indicateur. L’indicateur apparaît seulement sur une journée, ok!

    Remarque:
    paramètres modifiés comme suit,

    ALPHAfond=250
    AlphaPivotsIntermediaires=250
    AlphaPivotsPrincipaux=250

    Comme tu peux le voir, les zones de fond d’écran de couleur n’apparaisse pas.

    sais tu pourquoi?

    CODE-NICOLAS.png CODE-NICOLAS.png
    #192998 quote
    Nicolas
    Keymaster
    Master

    Oui je viens de voir qu’il y avait une faute de frappe sur un nom de variable, j’ai donc corrigé le code ci-dessus, il faut refaire un copier/coller de celui-ci en écrasant l’ancienne version. Je suis content que le code soit fonctionnel.

    christophe11560 thanked this post
    #193047 quote
    christophe11560
    Participant
    Senior

    Bonjour Nicolas,
    Merci beaucoup, par contre tu as oublié de joindre le code corrigé 🙂

    dans cette attente

    bonne continuation et encore merci

    #193049 quote
    christophe11560
    Participant
    Senior

    OK je n’avais pas compris, c’était directement modifié dans le code du dessus !!!
    bonne journée !!!

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

Codage intraDay: Indicateur visible only jour en cours


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
Summary

This topic contains 12 replies,
has 2 voices, and was last updated by christophe11560
3 years, 10 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 05/04/2022
Status: Active
Attachments: 5 files
Logo Logo
Loading...