Bonjour
j’utilise ce code de tend RL trouvé ici sur un graphique en renko 2
le code n’arrete pas de se recalculer a la moindre intervention (passage d’ordre par exemple et me dit a chaque fois qu’il faudrait rajouter defparam calculateonlastbars
c’est ce que j’ai fait mais ca ne change rien ou alors je en le met pas au bon endroit.
pouvez vous m’aider svp?
cdlt
// — settings
len = 100
off= 0
dev= 0.01 //Deviation (minval=0.01)
// — end of settings
once length=100
if barindex>len then
c = close
cp = c
lreg = linearregression[len](close)[off]
lregx = linearregression[len](close)[off+1]
b = barindex
s = lreg – lregx
intr = lreg – b*s
dS = 0.0
for i=0 to len-1 do
dS= dS + square(cp[i]-(s*(b-i)+intr))
de = sqrt(dS/(len))
up = (-de*dev) + c
dn= (de*dev) + c
next
c5=(high+low)/2
//
factor = 0.001
hb = 0.00
hb = (hb[1])
hl = 0.000
hl = (hl[1])
lb = 0.00
lb = (lb[1])
l1 = 0.000
l1 = (l1[1])
c2 = 0
c2 = (c2[1]) + 1
trend = 0
trend = (trend[1])
n = dn
x = up
if barindex=0 then
c2 = 0
lb = n
hb = x
l1 = c5
hl = c5
//hl
if c2 = 1 then
if x >= hb[1] then
hb = x
hl = c5
trend = 1
//trend
else
lb = n
l1 = c5
trend = -1
//trend
endif
endif
endif
if c > 1 then
if trend[1] > 0 then
hl = max(hl[1], c5)
if x >= hb[1] then
hb = x
//hb
else
if n < hb[1] - hb[1] * factor then
lb = n
l1 = c5
trend = -1
//trend
endif
endif
else
l1 = min(l1[1], c5 )
if n <= lb[1] then
lb = n
//lb
else
if x > lb[1] + lb[1] * factor then
hb = x
hl = c5
trend = 1
//trend
endif
endif
endif
endif
if trend = 1 then
v = hb
r=255
g=255
b=0
backgroundcolor (176,242,182)
else
v = lb
r=0
g=0
b=0
backgroundcolor (254,191,210)
endif
endif
//band = average[length](AverageTrueRange[1](close))*2
return v coloured(r,g,b) style(line,3)//, v+band coloured(168,168,168), v-band coloured(168,168,168)