Voici le dashboard avec les 2 codes ensemble dans lequel le signal est correct mais pas le trend
defparam drawonlastbaronly=true
Xoffset = 20
// --- settings Tendance
z1=Average[20](close)
if close>z1 and open<>z1 and z1>z1[1] then
r=1
elsif close<z1 and open<>z1 and z1<z1[1] then
r=-1
else
r=0
endif
// --- end of settings
//label
DRAWTEXT("TREND:",barindex-Xoffset,0.1,SansSerif,Bold,16)coloured(230,230,250)
If r=1 then
drawtext("UP ▲",barindex-5,0.1,SansSerif,Bold,16)coloured(30,144,255)
Elsif r=-1 then
drawtext("DOWN ▼",barindex-5,0.1,SansSerif,Bold,16)coloured(255,48,48)
Elsif r=0 then
drawtext("NEUTRAL ■",barindex-5,0.1,SansSerif,Bold,16)coloured(180,180,0)
endif
// --- settings Signal
z1=ExponentialAverage[8](close)
z2 =Average[20](close)
e= z1 - z2
If z1<z2 and z1>z1[1] and e>=e[1] and close>open then
r=1
elsif z1<z2 and z1<z1[1]and e<=e[1]and close<open then
r=-2
elsif z1>z2 and z1>z1[1]and e>=e[1]and close>open then
r=2
elsif z1>z2 and z1<z1[1] and e<=e[1]and close<open then
r=-1
else
r=0
endif
// --- end of settings
//label
DRAWTEXT("SIGNAL:",barindex-Xoffset,-0.5,SansSerif,Bold,16)coloured(230,230,250)
If r=1 then
drawtext("LIGHT BUY ▲",barindex-5,-0.5,SansSerif,Bold,16)coloured(30,144,255)
Elsif r=2 then
drawtext("BUY ▲▲",barindex-6,-0.5,SansSerif,Bold,16)coloured(30,144,255)
Elsif r=-1 then
drawtext("LIGHT SELL ▼",barindex-5,-0.5,SansSerif,Bold,16)coloured(255,48,48)
Elsif r=-2 then
drawtext("SELL ▼▼",barindex-6,-0.5,SansSerif,Bold,16)coloured(255,48,48)
elsif r=0 then
DRAWTEXT("No signal, wait..",barindex-3,-0.5,SansSerif,Bold,16)coloured(180,180,0)
endif
Return