alladir: I kept getting errors and I finally tracked it down to the first line of code.
- There are no mind readers here. "getting errors" says nothing.
-
Post all the relevant code.
(SLprice-askprice)
Where are the definitions?
They are just prices.... ask price and stop loss price... it's finding the difference between them and dividing by Point to get the number of points between the two.
E.g. something like
double SLprice = 1.11111 double askprice = 1.11121
so in this case, the difference is 10 points
But my question is, since the answer is always an integer, why do I need it to be a double variable to get the correct answer?
(Yeh, not so much an MQL question, but a programming question.. I assumed some well-known principle amongst programmers)

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Feel free to ignore this if you want, it's a little simple, but I hope someone can explain this aspect of programming to me?
I tried to find the number of points between 2 prices (i.e. an integer like 10 points, or 2 points).
I kept getting errors and I finally tracked it down to the first line of code.
Changing it to a double fixed the problem, even though the answer from the equation will always be an integer.
I remember now, when I wrote it I was a bit iffy as to which to use, but generally go for int if possible for efficiency.
Can anyone explain to me what I should to next time I get a similar situation?