Comme ç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 = 0
upColorR = 50
upColorG = 205
upColorB = 50
midColorR = 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
endif
if 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 = 55
if 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]
endif
longCondition = 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)
endif
Return filt as “Range Filter”, hband as “High Target”, lband as “Low Target”