Page 1 of 1

Détection de figures chartistes - division par zero

Posted: 08 Jul 2013 06:51
by Piet
Bonjour

Dans le programme reconnaissance de figure chartiste,

Express P1_Pendu
Vars
numeric Pendu, Corps_H, Corps_B, Ombre, Corps;
numeric Flag;
Calculation
Corps_H = Max(Open,Close);
Corps_B = Min(Open,Close);
Flag=0;
if Open <> Close then Flag = Flag + 1;
if (High > Corps_H) then Flag = Flag + 1;
if (Low = Corps_B) then Flag = Flag + 1;
Ombre = (High - Corps_H);
Corps = AbsValue (Open-Close);
if Ombre / Corps >= 2 then Flag = Flag + 1;
if Flag = 4 then HighLightRGB("ellipse",255,64,255);
Interpretation
begin
end
plotcandles (open,close,high,low);



j’ai un petit souci de programmation ,à la 4éme condition , j’ai une erreur de type « division par zéro ? » à la ligne : « if Ombre / Corps >= 2 then Flag = Flag + 1 ; »

pourtant en première condition j’ai bien : if open <> Close then Flag = Flag + 1 ;

ce qui sous entend que le diviseur n’est pas égal à zéro ? j’ai bien essayé de mettre l’expression entre parenthèse (open <> Close) mais j’ai le message d’erreur « Division by zero » que faire ?

Bien à vous

Re: Détection de figures chartistes - division par zero

Posted: 08 Jul 2013 10:25
by Piet
Résolu

on remplace

" Ombre = (High - Corps_H);
Corps = AbsValue (Open-Close);
if (Open <> Close) then
if ((High - Corps_H)/AbsValue (Open-Close)) >= 2 then Flag = Flag + 1; "




Et la 4éme condition se présentera comme sous condition

if (Open <> Close) then
if ((High - Corps_H)/AbsValue (Open-Close)) >= 2 then Flag = Flag + 1;

//vérifie que la hauteur de l'ombre = 2X le corps

ce qui donne en simplifiant

Express Pendu

Vars
numeric Flag;
numeric Corps_H, Corps_B;

Calculation
Corps_H = Max(Open,Close);
Corps_B = Min(Open,Close);
Flag=0; // initialisation du flag

if (Open <> Close) then Flag = Flag + 1;
if (High > Corps_H) then Flag = Flag + 1;
if (Low = Corps_B) then Flag = Flag + 1;
if (Open <> Close) then
if ((High - Corps_H)/AbsValue (Open-Close)) >= 2 then Flag = Flag + 1;

if Flag = 4 then HighLightRGB("ellipse",255,64,255);

Interpretation
begin
end
plotcandles (open,close,high,low);