Bonjour
Le programme ci-dessous me détecte toutes les bougies , j'ai un signal (highlightRGB) sur toutes les bougies et je n'arrive pas à y remédier
j'ai inversé les signes dans la première condition (détection de bougie rouge ou verte )  mais cela ne corrige pas l'erreur 
//Détection de 4 bougies vertes signalée par une couleur
Express P1_Serie
Vars
	numeric somP; 
	numeric Stop1;
	numeric i;
	numeric Flag;
	series Color_B;
Calculation
	Color_B=0;
		if Open > Close then Color_B=-1; //detection couleur: -1 signifie bougie rouge
		if Open < Close then Color_B= 1; //detection couleur: 1 signifie bougie verte
	
	somP=0; // initialisation
	Stop1=0;
	
		for i = 1 to 10 // boucle de 10 permet de verifier les 10 dernières bougies
			begin
				if (Color_B=1) and (Stop1 = 0) then somP= somP+1; 
				if (Color_B <> 1) then Stop1 = 1;                           
			end										  
				
			if (Color_B= -1) and (SomP>= 4) then Flag = -1;
			if (Flag = -1) then HighLightRGB("Slot",0,202,202);
			
Interpretation
	begin
	end
	plotcandles (open,close,high,low);
Il y a une erreur mais où ?	
n'aurait on pas pu ecrire plus simplement
 if (close > close[1]) and (close > close[2])  and  (close > close[3])then HighLightRGB("Slot",0,202,202); ?
Bien à vous
			
			
									
						
										
						Detection de figures chartistes : serie de 4 bougies
- 
				bohsunca
 
Re: Detection de figures chartistes : serie de 4 bougies
Bonjour,
oui, il y a deux erreurs dans cette Programme.
Le code correct est:
Express Formation
vars
numeric sumP;
numeric stop1;
numeric i;
numeric flag;
series Color_B;
calculation
Color_B = 0;
if Open > Close then Color_B = -1;
if Open < Close then Color_B = 1;
sumP = 0;
stop1 = 0;
flag = 0;
for i = 1 to 10
begin
if (Color_B = 1) and (stop1 = 0) then sumP = sumP + 1;
if (Color_B <> 1) then stop1 = 1;
end
  
if (Color_B = -1) and (sumP >= 4) then flag = -1;
if (flag = -1) then HighLightRGB("slot",0,202,202);
interpretation
begin
end
plotcandles(open, close, high, low);
			
			
									
						
										
						oui, il y a deux erreurs dans cette Programme.
Le code correct est:
Express Formation
vars
numeric sumP;
numeric stop1;
numeric i;
numeric flag;
series Color_B;
calculation
Color_B = 0;
if Open > Close then Color_B = -1;
if Open < Close then Color_B = 1;
sumP = 0;
stop1 = 0;
flag = 0;
for i = 1 to 10
begin
if (Color_B = 1) and (stop1 = 0) then sumP = sumP + 1;
if (Color_B <> 1) then stop1 = 1;
end
if (Color_B = -1) and (sumP >= 4) then flag = -1;
if (flag = -1) then HighLightRGB("slot",0,202,202);
interpretation
begin
end
plotcandles(open, close, high, low);