trigger = CALL "MM50 Trigger V2"
MM50 = Average[50](close)
ccindex50 = CCI[50](close)
//ccindex20 = CCI[20](close)
bas = MM50 - Delta
haut = MM50 + Delta
bas3 = MM50 - (3*Delta)
haut3 = MM50 + (3*Delta)
c1 = (trigger = 1)
c2 = (ccindex50 >= 85)
c3 = (trigger = -1)
c4 = (ccindex50 <= -85)
c5 = (close > haut OR close > MM50)AND (close < haut3)
c6 = (close < bas OR close < MM50) AND (close > bas3)
c7 = (ccindex50[1] < ccindex50[0])
c8 = (ccindex50[1] > ccindex50[0])
i = 0
volat = 1
for i = 5 to 50
if (highest[MM50[i]](close)) - (lowest [MM50[i]](close)) < (3*Delta) then
volat = 0
break
endif
next
// Signal achat
if c1 AND (c2 OR c7) AND c5 AND (volat = 0)then
//backgroundcolor(151,223,198)
backgroundcolor (9, 82, 40)
endif
// Signal vente
if c3 AND (c4 OR c8) AND c6 AND (volat = 0)then
//backgroundcolor(252,93,93)
backgroundcolor(231, 62, 1)
endif
return