can't read the value in EA

 
                     bool green=false;
                     bool red=false;
                     int openprice6=int(iOpen(Symbol(),10080,6));
                     int closeprice6=int(iClose(Symbol(),10080,6));
                     int pre7=int(iClose(Symbol(),10080,7));
                     if((openprice6<closeprice6)||(pre7<closeprice6)) red=true;
                     if((openprice6>closeprice6)||(pre7>closeprice6)) green=true;
                     Alert("red=",red,"green=",green);

I red openprice6 and  closeprice6' value in script is correct,But in EA,I can't read value,return the   openprice6 and  closeprice6  Value is 0; WAY

 
47803124:

I red openprice6 and  closeprice6' value in script is correct,But in EA,I can't read value,return the   openprice6 and  closeprice6  Value is 0; WAY

i doubt, very much the "script is correct". You have converted the prices to int values. This results in prices being rounded to the nearest int. example prices below 0.5 will give result of 0.

 
Michael Charles Schefe #:

i doubt, very much the "script is correct". You have converted the prices to int values. This results in prices being rounded to the nearest int. example prices below 0.5 will give result of 0.

the price is 2650,not 0.x

 
The conversion of double value of iOpen and iClose automatically truncate the decimate part therefore leaving you with 0.
I can see you want to compare two values, go ahead and do it with double. There is no need to convert to int.