Modification color between
Forums › ProRealTime forum Français › Support ProBuilder › Modification color between
- This topic has 14 replies, 3 voices, and was last updated 1 month ago by finplus.
-
-
11/16/2024 at 1:12 PM #240409
Bonjour,
je souhaiterai modifier les couleurs de l’indicateur ci-après de la façon suivante :
si hband > hband[1] and lband > band[1] alors la couleur entre lband et hband est bleue et si hband < hband[1] and lband < band[1] alors la couleur entre lband et hband est rouge
merci.
// Original Script > @DonovanWall
// Adapted Version > @guikroth//////////////////////////////////////////////////////////////////////////
// Settings for 5min chart, BTCUSDC. For Other coin, change the parameters
//////////////////////////////////////////////////////////////////////////// Color variables
downColorR = 255
downColorG = 69
downColorB = 0upColorR = 50
upColorG = 205
upColorB = 50midColorR = 0
midColorG = 191
midColorB = 255// Source
src = 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 Range
wper = per*2 -1
avrng = exponentialaverage[per](abs(src-src[1]))
smrng = mult * exponentialaverage[wper](avrng)// Range Filter
rngfilt = src
If src > rngfilt[1] then
If rngfilt[1] > src-smrng then
rngfilt = rngfilt[1]
Else
rngfilt = src-smrng
endif
elsif rngfilt[1] < src+smrng then
rngfilt = rngfilt[1]
else
rngfilt = src+smrng
endif
filt = rngfilt// Filter Direction
upward = 0
If filt > filt[1] then
upward = upward[1]+1
elsif filt < filt[1] then
upward = 0
else
upward = upward[1]
endif
downward = 0
If filt < filt[1] then
downward = downward[1]+1
elsif filt > filt[1] then
downward = 0
else
downward = downward[1]
endif// Target Bands
hband = filt + smrng
lband = filt – smrng// Colors
If upward > 0 then
filtcolorR = upColorR
filtcolorG = upColorG
filtcolorB = upColorB
elsif downward > 0 then
filtcolorR = downColorR
filtcolorG = downColorG
filtcolorB = downColorB
else
filtcolorR = midColorR
filtcolorG = midColorG
filtcolorB = midColorB
endifif src > filt and src > src[1] and upward > 0 then
barcolorR = upColorR
barcolorG = upColorG
barcolorB = upColorB
elsif src > filt and src < src[1] and upward > 0 then
barcolorR = upColorR
barcolorG = upColorG
barcolorB = upColorB
elsif src < filt and src < src[1] and downward > 0 then
barcolorR = downColorR
barcolorG = downColorG
barcolorB = downColorB
elsif src < filt and src > src[1] and downward > 0 then
barcolorR = downColorR
barcolorG = downColorG
barcolorB = downColorB
else
barcolorR = midColorR
barcolorG = midColorG
barcolorB = midColorB
endifcolorbetween(hband,filt,upColorR,upColorG,upColorB,30)
colorbetween(lband,filt,downColorR,downColorG,downColorB,30)// Break Outs
longCond = (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 = 0
If longCond then
CondIni = 1
elsif shortCond then
CondIni = -1
else
CondIni = CondIni[1]
endiflongCondition = longCond and CondIni[1] = -1
shortCondition = shortCond and CondIni[1] = 1//Alerts
If longCondition then
Drawarrowup(barindex,low-AverageTrueRange[14](close)) coloured(0,255,255)
endif
If shortCondition then
Drawarrowdown(barindex,high+AverageTrueRange[14](close)) coloured(255,255,0)
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”
11/17/2024 at 5:45 AM #240418Bonjour
Ajoutez ce bout de code pour voir12345678910111213//////////////////////////////////////////////////////////////////////////// Zone de couleurs : selon des conditions//////////////////////////////////////////////////////////////////////////alphaZoneUp = 111alphaZoneDown = 55if hband > hband[1] and lband > lband[1] thenDRAWTRIANGLE(barindex[0], hband[0], barindex[1] , hband[1] , barindex[0], lband[0]) coloured ( 0,111,255,alphaZoneUp) bordercolor(0,111,255,0)DRAWTRIANGLE(barindex[0], lband[0], barindex[1] , lband[1] , barindex[1], hband[1]) coloured ( 0,111,255,alphaZoneUp) bordercolor(0,111,255,0)endifif hband < hband[1] and lband < lband[1] thenDRAWTRIANGLE(barindex[0], hband[0], barindex[1] , hband[1] , barindex[0], lband[0]) coloured ( 255,64,0,alphaZoneDown) bordercolor(255,64,0,0)DRAWTRIANGLE(barindex[0], lband[0], barindex[1] , lband[1] , barindex[1], hband[1]) coloured ( 255,64,0,alphaZoneDown) bordercolor(255,64,0,0)endif11/17/2024 at 10:04 AM #24042111/17/2024 at 11:00 AM #240426Le remplissage se fait selon les conditions que tu as demandé
Désactive les lignes : – 112 et 113
//colorbetween(hband,filt,upColorR,upColorG,upColorB,30)
//colorbetween(lband,filt,downColorR,downColorG,downColorB,30)Augmente les valeurs (max 255) de ces variables : alphaZoneUp et alphaZoneDown
11/17/2024 at 11:07 AM #240428Comme ça
// Original Script > @DonovanWall
// Adapted Version > @guikroth//////////////////////////////////////////////////////////////////////////
// Settings for 5min chart, BTCUSDC. For Other coin, change the parameters
//////////////////////////////////////////////////////////////////////////// Color variables
downColorR = 255
downColorG = 69
downColorB = 0upColorR = 50
upColorG = 205
upColorB = 50midColorR = 0
midColorG = 191
midColorB = 255// Source
src = 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 Range
wper = per*2 -1
avrng = exponentialaverage[per](abs(src-src[1]))
smrng = mult * exponentialaverage[wper](avrng)// Range Filter
rngfilt = src
If src > rngfilt[1] then
If rngfilt[1] > src-smrng then
rngfilt = rngfilt[1]
Else
rngfilt = src-smrng
endif
elsif rngfilt[1] < src+smrng then
rngfilt = rngfilt[1]
else
rngfilt = src+smrng
endif
filt = rngfilt// Filter Direction
upward = 0
If filt > filt[1] then
upward = upward[1]+1
elsif filt < filt[1] then
upward = 0
else
upward = upward[1]
endif
downward = 0
If filt < filt[1] then
downward = downward[1]+1
elsif filt > filt[1] then
downward = 0
else
downward = downward[1]
endif// Target Bands
hband = filt + smrng
lband = filt – smrng// Colors
If upward > 0 then
filtcolorR = upColorR
filtcolorG = upColorG
filtcolorB = upColorB
elsif downward > 0 then
filtcolorR = downColorR
filtcolorG = downColorG
filtcolorB = downColorB
else
filtcolorR = midColorR
filtcolorG = midColorG
filtcolorB = midColorB
endifif src > filt and src > src[1] and upward > 0 then
barcolorR = upColorR
barcolorG = upColorG
barcolorB = upColorB
elsif src > filt and src < src[1] and upward > 0 then
barcolorR = upColorR
barcolorG = upColorG
barcolorB = upColorB
elsif src < filt and src < src[1] and downward > 0 then
barcolorR = downColorR
barcolorG = downColorG
barcolorB = downColorB
elsif src < filt and src > src[1] and downward > 0 then
barcolorR = downColorR
barcolorG = downColorG
barcolorB = downColorB
else
barcolorR = midColorR
barcolorG = midColorG
barcolorB = midColorB
endif///colorbetween(hband,filt,upColorR,upColorG,upColorB,30)
///colorbetween(lband,filt,downColorR,downColorG,downColorB,30)//////////////////////////////////////////////////////////////////////////
// Zone de couleurs : selon des conditions
//////////////////////////////////////////////////////////////////////////
alphaZoneUp = 111
alphaZoneDown = 55if hband > hband[1] and lband > lband[1] then
DRAWTRIANGLE(barindex[0], hband[0], barindex[1] , hband[1] , barindex[0], lband[0]) coloured ( 0,111,255,alphaZoneUp) bordercolor(0,111,255,0)
DRAWTRIANGLE(barindex[0], lband[0], barindex[1] , lband[1] , barindex[1], hband[1]) coloured ( 0,111,255,alphaZoneUp) bordercolor(0,111,255,0)
endif
if hband < hband[1] and lband < lband[1] then
DRAWTRIANGLE(barindex[0], hband[0], barindex[1] , hband[1] , barindex[0], lband[0]) coloured ( 255,64,0,alphaZoneDown) bordercolor(255,64,0,0)
DRAWTRIANGLE(barindex[0], lband[0], barindex[1] , lband[1] , barindex[1], hband[1]) coloured ( 255,64,0,alphaZoneDown) bordercolor(255,64,0,0)
endif// Break Outs
longCond = (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 = 0
If longCond then
CondIni = 1
elsif shortCond then
CondIni = -1
else
CondIni = CondIni[1]
endiflongCondition = longCond and CondIni[1] = -1
shortCondition = shortCond and CondIni[1] = 1//Alerts
If longCondition then
Drawarrowup(barindex,low-AverageTrueRange[14](close)) coloured(0,255,255)
endif
If shortCondition then
Drawarrowdown(barindex,high+AverageTrueRange[14](close)) coloured(255,255,0)
endifReturn filt as “Range Filter”, hband as “High Target”, lband as “Low Target”
11/17/2024 at 11:28 AM #24043011/18/2024 at 1:39 PM #240475En fait, ce que je recherche est exactement ce que ton graphique mentionne. Sauf que quand j’intègre tes lignes de code, le rendu n’est pas le même. Je pense que quelque chose m’échappe.
Merci encore pour ton aide sur ce sujet.
11/18/2024 at 3:11 PM #240485123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157// 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 paremetersper = 100//defval=100, minval=1, "Sampling Period"// Range Multipliermult = 3//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 = midColorBendif//colorbetween(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(0,255,255)endifIf shortCondition thenDrawarrowdown(barindex,high+AverageTrueRange[14](close)) coloured(255,255,0)endif//////////////////////////////////////////////////////////////////////////// Zone de couleurs : selon des conditions//////////////////////////////////////////////////////////////////////////if hband > hband[1] and lband > lband[1] thenred=0green=0blue=255elsif hband < hband[1] and lband < lband[1] thenred=255green=0blue=0elsered=255green=255blue=255endifcolorbetween(lband,hband,red,Green,Blue,30)Return 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"1 user thanked author for this post.
11/18/2024 at 4:12 PM #24049111/18/2024 at 5:38 PM #24050311/18/2024 at 8:33 PM #24050711/19/2024 at 9:48 AM #24051511/21/2024 at 1:59 AM #240610Essayez avec cette approche simplifiée.
12345678910111213141516//// v1.1 /////////////////////////////////////////////////////////////////// Zone de couleurs : selon des conditions////////////////////////////////////////////////////////////////////////////mbTendance = ( Average[9](filt) + filt)/2if mbTendance > mbTendance[1] thenred=0green=0blue=255elsif mbTendance < mbTendance[1] thenred=255green=0blue=0endifcolorbetween(lband,hband,red,Green,Blue,88)Return 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"1 user thanked author for this post.
11/21/2024 at 10:41 AM #24061411/22/2024 at 10:15 AM #240642 -
AuthorPosts
Find exclusive trading pro-tools on