Problem with double/double

 
Hello everyone, 
I have a problem with a simple math "double/double" in my system. I've been trying to find an answer but haven't come up with a topic that's exactly what I'm looking for
My code here. I can print value x1,x2,x3,x4,x5,x6 , but x7 doesn't work. Someone can give me the answer, please!
      x1=iClose(NULL,0,i+1);
      x2=iClose(NULL,0,i+2);
      x3=iClose(NULL,0,i+3);
      x4=iClose(NULL,0,i+4);
      x5=iClose(NULL,0,i+5);
      x6=iClose(NULL,0,i+6);
      x7=x1/x2;
 
You may share your code, journal messages and more if you expect an answer.
 
Yashar Seyyedin #:
You may share your code, journal messages and more if you expect an answer.

It's just a simple idea, I want to do division x7=x1/x2 or x7=(x1-x2)/x2 and display the result on the trading screen. I get value x1,x2,x3,x4,x5,x6 correctly, but x7 it doesn't work

 
Alex Nguyen #: but x7 it doesn't work
  1. “Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — could be anything, meaningless.
    We can't read your mind nor see your machine; only what you give us on this forum.
         How To Ask Questions The Smart Way. (2004)
              When asking about code
              Be precise and informative about your problem

  2. Always post all relevant code (using Code button) or attach the source file. We have no idea what your x1-x7 are typed as. We have no idea what i is or what iClose is returning.

  3. Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
              Code debugging - Developing programs - MetaEditor Help
              Error Handling and Logging in MQL5 - MQL5 Articles (2015)
              Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
              Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)

 
William Roeder #:
  1. “Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — could be anything, meaningless.
    We can't read your mind nor see your machine; only what you give us on this forum.
         How To Ask Questions The Smart Way. (2004)
              When asking about code
              Be precise and informative about your problem

  2. Always post all relevant code (using Code button) or attach the source file. We have no idea what your x1-x7 are typed as. We have no idea what i is or what iClose is returning.

  3. Use the debugger or print out your variables, including _LastError and prices and find out why. Do you really expect us to debug your code for you?
              Code debugging - Developing programs - MetaEditor Help
              Error Handling and Logging in MQL5 - MQL5 Articles (2015)
              Tracing, Debugging and Structural Analysis of Source Code - MQL5 Articles (2011)
              Introduction to MQL5: How to write simple Expert Advisor and Custom Indicator - MQL5 Articles (2010)

Thank you for your comment. I have found the solution. x2 must be different zero

//--
      x1=iClose(NULL,0,i+1);
      x2=iClose(NULL,0,i+2);
      x3=iClose(NULL,0,i+3);
      x4=iClose(NULL,0,i+4);
      x5=iClose(NULL,0,i+5);
      x6=iClose(NULL,0,i+6);
      if(x2!=0)
        {
         x7=(x1-x2)*100/x2;
        }