error in MT4

 

int SMMrd_131204130119()

{

double Ind_Wert=differenzErmitteln(BewegungsWert(2),100);


if(-1.49 < Ind_Wert && Ind_Wert < -0.12)

{

Debugging(Ind_Wert);

return(1);

}

Debugging("##_"+Ind_Wert+"_##");

return(0);

}

//++++++++++++++++++++++++++++++++++++

double BewegungsWert(int Zeitraum) // Gibt einen Wert eines Zeitraums zurück, der angibt ob er aktuell in diesem Zeitraum oberhalb oder unterhalb sich bewegt

{

// Steigend oder Fallend? Summe der differenz 2er Kerzen, eines Zeitraumes

double Summe=0.0;

for(int i=0;i<Zeitraum;i++)

{

Summe=Summe+(Close[1+i]-Close[2+i]);

}

return (Summe*1000);

}

//++++++++++++++++++++++++++++++++++

double differenzErmitteln(double WertXProzent, double Wert100Prozent)

{

double Prozentwert=0;

Prozentwert=(100*WertXProzent)/Wert100Prozent;

return (Prozentwert);

}

//++++++++++++++++++++++++++++++++++

void Debugging(string Text)

{

int handle;

// Ext File schreiben

handle = FileOpen(ErrorPfad,FILE_CSV | FILE_READ | FILE_WRITE,' ');

FileSeek(handle,0,SEEK_END);

FileWrite(handle,Text);

FileClose(handle);

return;

}


If I used the first function, normally the values with "-1.49" and "-0.12" are not in the area of trues!!

(the written of the textfile: with "##_" is false, and without is true)

I get this in my Textfile...

sometimes I get a true-value, and sometimes a false-value.

Thats a problem if I work with money!! :-(

You can search by: "strg+F" with the value "-0.12"!! CRAZY...

PS: MT4+ Values: 2011.11.01 - 2011.12.01, EUR-USD, M1, only OpenPrice, Spread2

Files:
 
1111170447:

<CODE REMOVED>


If I used the first function, normally the values with "-1.49" and "-0.12" are not in the area of trues!!

(the written of the textfile: with "##_" is false, and without is true)

I get this in my Textfile...

sometimes I get a true-value, and sometimes a false-value.

Thats a problem if I work with money!! :-(

You can search by: "strg+F" with the value "-0.12"!! CRAZY...

PS: MT4+ Values: 2011.11.01 - 2011.12.01, EUR-USD, M1, only OpenPrice, Spread2

When posting code . . . please use the SRC button to post code: How to use the SRC button.


Not crazy, it's the way in which double values are stored in memory . . .

-0.12 can != -0.12 read this thread: Can price != price ?

Reason: