TickValue *=10;
is the same as . . .
TickValue = TickValue * 10;
From the documentation . . . Assignment operation
The code is being used to adjust for 4/5 digit Brokers.
is the same as . . .
From the documentation . . . Assignment operation
The code is being used to adjust for 4/5 digit Brokers.
I realize that it is 3 & 5 digit compensation, just never seen a mathematical equation like 'TickValue *= 10' before and as such I didn't recognize it as being a 'relational assignment' formula.
Thus y /= x; is the same thing as y / x; and what the rest of the world uses and doesn't need the equal signs.
So putting in all of the needless 'equal signs' adds complication and confusion.
I can't see that this follows any correct current mathematical rules of equations, but I guess that MQ just decided to ''make it up' as they went along' As they did make an entirely new programming language, they had the freedom to do so.
But for:
Logical shift of y representation to the right by x bit y >>= x;
Logical shift of y representation to the left by x bit y <<= x;
It does distinguish these as a specific relational value that isn't standard mathematical nomenclature as far as I know.
So just have to chalk it up to part of the MQL learning curve I guess.
I wonder if this group of Assignment operation relational formulas ARE actually used anywhere else by anybody else?
Got it book marked now: thanks Raptor.
Thus y /= x; is the same thing as y / x; and what the rest of the world uses and doesn't need the equal signs.
No, that is not correct. y /= x means dividing the y variable by the x and store the result in y. y / x simply means divide variable y by the variable x, but it says nothing about what to do with the result. The reason for having such assignment operators (like y *= x or y /= x or y += x) is to simply coding. y /= x is exactly the same as y = y/x.
I can't see that this follows any correct current mathematical rules of equations, but I guess that MQ just decided to ''make it up' as they went along' As they did make an entirely new programming language, they had the freedom to do so.
Other programming languages have similar expressions. C/C++ is such a programming language, and since MQL is modeled after C, I would expect MQL to have such assignment operators.
the term used for this operation is 'compound assignment'
I wonder if this group of Assignment operation relational formulas ARE actually used anywhere else by anybody else?
Yes, C# . . . http://msdn.microsoft.com/en-us/library/s2bkaksf
and PHP . . . http://www.php.net/manual/en/language.operators.assignment.php
and C++ . . . http://www.cplusplus.com/doc/tutorial/operators/
Python has an equivalent . . . http://docs.python.org/library/operator.html#operator.__imul__
and Java . . . http://java.about.com/od/c/g/compoundassgnment.htm
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
// from p64 of 'Expert Advisor Programming' by Andrew R. Young:
double TickValue = MarketInfo(Symbol(), MODE_TICKVALUE);
If (Point == 0.001 || Point == 0.00001) TickValue *= 10;
Is the equation in Red above a typo or ???
If not what does it mean and what mathematical calculations are being done?
Shouldn't it be something like:
If (Point == 0.001 || Point == 0.00001) double UseTickValue = TickValue * 10;