// Définition des variables
nbATR = nATR // 1
threshold = nthreshold // 10
//if drawseg then
//drawseg = 0
//endif
CCIlength = 14
CCIthresholdlow = 0-threshold
CCIthresholdhigh = threshold
CCIentrylevel = entrylevel //-100
CCIstoplevel = stoplevel //100
rge = averagetruerange[10](close[0])
mm200 = average[200]
mm50 = average[50]
// Calcul de l'indicateur CCI
CCIvalue = CCI[CCIlength]
//DRAWTEXT("#CCIvalue#", barindex, close-rge,SansSerif,Bold,10)
// Conditions d'entrée
if CCIvalue < CCIentrylevel and entrycondition = 0 then
entrycondition = 1
//DRAWARROWUP(barindex,low-rge)
//DRAWTEXT("#CCIvalue#,#CCIentrylevel#", barindex, close-10*rge,SansSerif,Bold,10)
endif
if CCIvalue >= CCIstoplevel or CCIvalue[1] > CCIthresholdhigh then
entrycondition = 0
endif
if entrycondition and CCIvalue >= CCIthresholdlow and CCIvalue <= CCIthresholdhigh and mm200 >= mm200[3] and close > mm200 and mm50 >= mm50[5] then
DRAWARROWUP(barindex+1,low-2*rge)coloured(10,255,10)
atr = averagetruerange[14](close)
DRAWSEGMENT(BarIndex,close+nbATR*atr,BarIndex+5,close+nbATR*atr) COLOURED(10,255,10)
//DRAWTEXT("#mm200#,#mm200[3]#",BarIndex+2, open+atr)
DRAWSEGMENT(BarIndex,close-nbATR*atr,BarIndex+5,close-nbATR*atr)
//DRAWTEXT("#open#,#atr#",BarIndex+2, open-atr)
entrycondition = 0
endif
RETURN