//signalBuy = 0
//signalSell = 0
P = 20
demiP = round(P/2)
temp = 2*WeightedAverage[demiP](close) - WeightedAverage[P](close)
racineP = round(SQRT(P))
MMHULL20 = WeightedAverage[racineP](temp)
PA = 100
demiPA = round(PA/2)
tempA = 2*WeightedAverage[demiPA](close) - WeightedAverage[PA](close)
racinePA = round(SQRT(PA))
MMHULL100 = WeightedAverage[racinePA](tempA)
PB = 500
demiPB = round(PB/2)
tempB = 2*WeightedAverage[demiPB](close) - WeightedAverage[PB](close)
racinePB = round(SQRT(PB))
MMHULL500 = WeightedAverage[racinePB](tempB)
a1 = MMHULL20[1] < MMHULL20[2]
a2 = MMHULL20[1] > MMHULL20[2]
b1 = MMHULL20 > MMHULL20[1]
b2 = MMHULL20 < MMHULL20[1]
c1 = MMHULL100 > MMHULL100[2] AND MMHULL100[2] > MMHULL100[4]
c2 = MMHULL100 < MMHULL100[2] AND MMHULL100[2] < MMHULL100[4]
d1 = MMHULL500 > MMHULL500[2] AND MMHULL500[2] > MMHULL500[4]
d2 = MMHULL500 < MMHULL500[2] AND MMHULL500[2] < MMHULL500[4]
IF a1 AND b1 AND c1 AND d1 THEN
//signalBuy = 10
//signalSell = 0
drawarrowup(barindex,low) coloured(0,200,0)
ELSIF a2 AND b2 AND c2 AND d2 THEN
//signalSell = 10
//signalBuy= 0
drawarrowdown(barindex,high) coloured(200,0,0)
ENDIF
RETURN //signalBuy COLOURED (0,153,204) AS "Signal Achat",signalSell COLOURED (220,100,100) AS "Signal Vente"