Need help for double condition

 

Dear,

I am getting problem about double value condition: I wrote code below:

double am0_13 = iMA(NULL,PERIOD_M5,MA2_5min,0,Mode_EMA,MaPrice,0);
double am1_13 = iMA(NULL,PERIOD_M5,MA2_5min,0,Mode_EMA,MaPrice,1);

in the chart MA1 show = 1.53977 and MA2 show = 1.53975

When I write alert(am0_13); am0_13 value show : 1.5398 and alert(am1_13) the value show also 1.5398

alert(am1_13-am0_13) show = 0. But it would be 0.00002

if((am1_13-am0_13)==0.00002) condition not work.

Please some one help me how if condition work. because it should be true but show false.

 
dralialadin:

Dear,

I am getting problem about double value condition: I wrote code below:

double am0_13 = iMA(NULL,PERIOD_M5,MA2_5min,0,Mode_EMA,MaPrice,0);
double am1_13 = iMA(NULL,PERIOD_M5,MA2_5min,0,Mode_EMA,MaPrice,1);

in the chart MA1 show = 1.53977 and MA2 show = 1.53975

When I write alert(am0_13); am0_13 value show : 1.5398 and alert(am1_13) the value show also 1.5398

alert(am1_13-am0_13) show = 0. But it would be 0.00002

if((am1_13-am0_13)==0.00002) condition not work.

Please some one help me how if condition work. because it should be true but show false.

Read this thread to the end: Can price != price ?