Détection de figures chartistes - division par zero

Post Reply
Piet
Posts: 4
Joined: 05 Jul 2013 13:41

Détection de figures chartistes - division par zero

Post 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
Piet
Posts: 4
Joined: 05 Jul 2013 13:41

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

Post 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);
Post Reply

Return to “WHS NanoTrader”