Modification des couleurs
Forums › ProRealTime forum Français › Support ProBuilder › Modification des couleurs
- This topic has 5 replies, 2 voices, and was last updated 1 year ago by finplus.
-
-
10/04/2023 at 7:29 AM #222014Range filter buy and sell123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139// Original Script > @DonovanWall// Adapted Version > @guikroth//////////////////////////////////////////////////////////////////////////// Settings for 5min chart, BTCUSDC. For Other coin, change the parameters//////////////////////////////////////////////////////////////////////////// Color variablesdownColorR = 255downColorG = 69downColorB = 0upColorR = 50upColorG = 205upColorB = 50midColorR = 0midColorG = 191midColorB = 255// Sourcesrc = customclose// Sampling Period// Settings for 5min chart, BTCUSDC. For Other coin, change the paremeters// per = defval=100, minval=1, "Sampling Period"// Range Multiplier// mult = defval=3.0, minval=0.1, "Range Multiplier"// Smooth Average Rangewper = per*2 -1avrng = exponentialaverage[per](abs(src-src[1]))smrng = mult * exponentialaverage[wper](avrng)// Range Filterrngfilt = srcIf src > rngfilt[1] thenIf rngfilt[1] > src-smrng thenrngfilt = rngfilt[1]Elserngfilt = src-smrngendifelsif rngfilt[1] < src+smrng thenrngfilt = rngfilt[1]elserngfilt = src+smrngendiffilt = rngfilt// Filter Directionupward = 0If filt > filt[1] thenupward = upward[1]+1elsif filt < filt[1] thenupward = 0elseupward = upward[1]endifdownward = 0If filt < filt[1] thendownward = downward[1]+1elsif filt > filt[1] thendownward = 0elsedownward = downward[1]endif// Target Bandshband = filt + smrnglband = filt - smrng// ColorsIf upward > 0 thenfiltcolorR = upColorRfiltcolorG = upColorGfiltcolorB = upColorBelsif downward > 0 thenfiltcolorR = downColorRfiltcolorG = downColorGfiltcolorB = downColorBelsefiltcolorR = midColorRfiltcolorG = midColorGfiltcolorB = midColorBendifif src > filt and src > src[1] and upward > 0 thenbarcolorR = upColorRbarcolorG = upColorGbarcolorB = upColorBelsif src > filt and src < src[1] and upward > 0 thenbarcolorR = upColorRbarcolorG = upColorGbarcolorB = upColorBelsif src < filt and src < src[1] and downward > 0 thenbarcolorR = downColorRbarcolorG = downColorGbarcolorB = downColorBelsif src < filt and src > src[1] and downward > 0 thenbarcolorR = downColorRbarcolorG = downColorGbarcolorB = downColorBelsebarcolorR = midColorRbarcolorG = midColorGbarcolorB = midColorBendifcolorbetween(hband,filt,upColorR,upColorG,upColorB,30)colorbetween(lband,filt,downColorR,downColorG,downColorB,30)// Break OutslongCond = (src > filt and src > src[1] and upward > 0) or (src > filt and src < src[1] and upward > 0)shortCond = (src < filt and src < src[1] and downward > 0) or (src < filt and src > src[1] and downward > 0)CondIni = 0If longCond thenCondIni = 1elsif shortCond thenCondIni = -1elseCondIni = CondIni[1]endiflongCondition = longCond and CondIni[1] = -1shortCondition = shortCond and CondIni[1] = 1//AlertsIf longCondition thenDrawarrowup(barindex,low-AverageTrueRange[14](close)) coloured("green",255)endifIf shortCondition thenDrawarrowdown(barindex,high+AverageTrueRange[14](close)) coloured("red",255)endifReturn filt style(line,4) coloured(barcolorR,barcolorG,barcolorB,255) as "Range Filter", hband style(line,2) coloured(upColorR,upColorG,upColorB,100) as "High Target", lband style(line,2) coloured(downColorR,downColorG,downColorB,100) as "Low Target"Share this
Bonjour, j’ai une demande : comment modifier le code pour que lorsque les cours sont dans la zone verte ou rouge; celles-ci changent de couleur : par exemple la zone verte soit modifiée en bleue ou la zone rouge en orange par exemple ? Merci.
10/04/2023 at 7:48 AM #222015Bonjour, la coloration des bandes se fait ligne 111 et 112 à l’aide des instructions colorbetween. Il suffit de mettre ces deux instructions entre des conditions (IF THEN ELSE END) en fonction de ce que l’on veut exactement et de changer les couleurs appliquée en fonction des conditions, sachant que la ligne du milieu est filt, le haut hband, le bas lband. Tu peux ne changer que la transparence en fonctions des conditions désirée (ici elle st à 30). Voir : https://www.prorealcode.com/documentation/colorbetween/
1 user thanked author for this post.
10/04/2023 at 8:02 AM #22201610/04/2023 at 8:34 AM #222021Bonjour, j’ai fait comme ceci mais le résultat n’est pas concluant pour l’intensité de la couleur de la zone du haut ne change pas. Une idée du problème SVP ?
if close > filt then
colorbetween(hband,filt,upColorR,upColorG,upColorB,40)
endif
if close < filt then
colorbetween(hband,filt,upColorR,upColorG,upColorB,20)
endif
if close < filt then
colorbetween(lband,filt,downColorR,downColorG,downColorB,40)
endif
if close > filt then
colorbetween(lband,filt,downColorR,downColorG,downColorB,20)
endif10/04/2023 at 8:45 AM #222023Il faut rassembler les instructions pour éviter de faire des tests redondant qui ralentissent inutilement l’indicateur…
if close > filt then
colorbetween(hband,filt,upColorR,upColorG,upColorB,60)
colorbetween(lband,filt,downColorR,downColorG,downColorB,10)
endif
if close < filt then colorbetween(hband,filt,upColorR,upColorG,upColorB,10) colorbetween(lband,filt,downColorR,downColorG,downColorB,60) endif10/04/2023 at 8:48 AM #222024 -
AuthorPosts
Find exclusive trading pro-tools on