Codage intraDay: Indicateur visible only jour en cours
Forums › ProRealTime forum Français › Support ProBuilder › Codage intraDay: Indicateur visible only jour en cours
- This topic has 12 replies, 2 voices, and was last updated 2 years ago by
christophe11560.
Tagged: opentimestamp, timestamp
-
-
05/04/2022 at 10:50 AM #192643
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!
christophe05/04/2022 at 12:51 PM #192647La copie d’écran n’est pas passé ?
Voici une condition pour tester si on est dans le dernier jour affiché:
1234567if intradaybarindex=0 thendaytime = opentimestampendifif timestamp>=daytime then//placer ici le code de ton indicateur ou de ce que tu dois afficherendif05/04/2022 at 1:11 PM #19265105/04/2022 at 5:23 PM #192689POUR INFORMATION IMAGE ET MERCI DE CHERCHER UNE SOLUTION A MON PROBLEME
CHRISTOPHE
05/04/2022 at 6:12 PM #192698CODE JOINT
05/05/2022 at 8:16 AM #192718Pour référence, je pose le code original ici:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960defparam calculateonlastbars = 80ALPHAfond=50AlphaPivotsIntermediaires=50AlphaPivotsPrincipaux=50if opentime=153000 thendrawvline(barindex) style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=153500 thendrawvline(barindex) style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=155000 thendrawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endifif opentime=161000 thendrawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endifif opentime=162500 thendrawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=163500 thendrawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=171500 thendrawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endifif opentime=180000 thendrawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=184500 thendrawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=193000 thendrawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endifif opentime=201500 thendrawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endifif opentime=210000 thendrawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endifif opentime=213000 thendrawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=220000 thendrawvline(barindex) style (DOTTEDline,2) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime >= 162500 AND opentime =< 163500 thenbackgroundcolor(0,204,102,ALPHAfond)endifif opentime >= 155000 AND opentime =< 161000 thenbackgroundcolor(0,204,102,ALPHAfond)endifif opentime >= 180000 AND opentime =< 180500 thenbackgroundcolor(0,204,102,ALPHAfond)endifif opentime >= 193000 AND opentime =< 193500 thenbackgroundcolor(0,204,102,ALPHAfond)endifRETURNIl 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.
05/05/2022 at 8:38 AM #192719Ci-joint la version modifiée pour afficher uniquement les lignes et les fonds sur la journée courante.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111defparam drawonlastbaronly=trueALPHAfond=50AlphaPivotsIntermediaires=50AlphaPivotsPrincipaux=50if intradaybarindex=0 or day<>day[1] thentodaybar=barindexendifif opentime=153000 then$pivoti[0] = barindex//drawvline(barindex) style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=153500 then$pivoti[1] = barindex//drawvline(barindex) style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=162500 then$pivoti[2] = barindex//drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=163500 then$pivoti[3] = barindex//drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=180000 then$pivoti[4] = barindex//drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=184500 then$pivoti[5] = barindex//drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif opentime=213000 then$pivoti[6] = barindex//drawvline(barindex)style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif 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)endifif opentime=161000 then$pivotp[1] = barindex//drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endifif opentime=171500 then$pivotp[2] = barindex//drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endifif opentime=193000 then$pivotp[3] = barindex//drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endifif opentime=201500 then$pivotp[4] = barindex//drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endifif opentime=210000 then$pivotp[5] = barindex//drawvline(barindex)style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endif// --------c1= opentime >= 162500 AND opentime =< 163500if c1 and not c1[1] then$start[0]=barindexelsif not c1 and c1[1] then$end[0]=barindexendifc2= opentime >= 155000 AND opentime =< 161000if c2 and not c2[1] then$start[1]=barindexelsif not c2 and c2[1] then$end[1]=barindexendifc3= opentime >= 180000 AND opentime =< 180500if c3 and not c3[1] then$start[2]=barindexelsif not c3 and c3[1] then$end[2]=barindexendifc4= opentime >= 193000 AND opentime =< 193500if c4 and not c4[1] then$start[3]=barindexelsif not c4 and c4[1] then$end[3]=barindexendif// --------if islastbarupdate thenfor i = 0 to 7 do//lignesif $pivoti[i]>todaybar thendrawvline($pivoti[i])style (DOTTEDline,1) COLOURED(153,153,153,AlphaPivotsIntermediaires)endifif isset($pivotp[i]) and $pivotp[i]>todaybar thendrawvline($pivotp[i])style (DOTTEDline,1) COLOURED(204,0,0, AlphaPivotsPrincipaux)endifif isset($start[i]) and $start[i]>todaybar then//fonddrawrectangle($start[i],0,$end[i],close*100) coloured(0,204,102,ALPHAfond) bordercolor(0,0,0,0)endifnextendifRETURN05/06/2022 at 3:40 PM #192820Bonjour,
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.
05/09/2022 at 10:42 AM #192935C’est très curieux, je ne reproduis pas, et il y a des choses anormales sur ton graphique.
- 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.
- 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.
05/10/2022 at 8:58 AM #192968bonjour 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,123ALPHAfond=250AlphaPivotsIntermediaires=250AlphaPivotsPrincipaux=250Comme tu peux le voir, les zones de fond d’écran de couleur n’apparaisse pas.
sais tu pourquoi?
05/10/2022 at 12:43 PM #192998Oui 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.
1 user thanked author for this post.
05/11/2022 at 10:32 AM #193047Bonjour Nicolas,
Merci beaucoup, par contre tu as oublié de joindre le code corrigé 🙂dans cette attente
bonne continuation et encore merci
05/11/2022 at 10:41 AM #193049OK je n’avais pas compris, c’était directement modifié dans le code du dessus !!!
bonne journée !!! -
AuthorPosts
Find exclusive trading pro-tools on