Bonjour,
Pouvez-vous m’aider à voir où se trouve mon bug?
J’ai un indicateur et un screener basés sur le même code. L’indicateur fonctionne, à mon avis, très bien alors que le screener me ressort des actions qui ne respectent pas les conditions. La condition de CCI semble correct. En tout cas, je n’ai pas encore vu de différence.
J’ai découvert que le problème proviendrait des MM. J’ai la MM200 qui doit être montante et le prix doit être au dessus et la MM50 qui doit seulement être montante.
Voici l’indicateur
// 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
et le code du screener
// Définition des variables
threshold = 10
dailysignal = 0
CCIlength = 14
CCIthresholdlow = -threshold
CCIthresholdhigh = threshold
CCIentrylevel = -100
CCIstoplevel = 100
mm200 = average[200](close)
mm50 = average[50](close)
// 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
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
dailysignal = 1
entrycondition = 0
else
dailysignal = 0
endif
okvol = ExponentialAverage[200](close*volume)>300000
risk = ((high-low)/high)*100
//risk = 0
//if mm200 >= mm200[3] then
//risk = mm200
//endif
SCREENER[dailySignal and okvol ](risk as "Risk")
Merci d’avance pour votre aide.