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
Please clarify the situation with operators == and !=. If compared variables are represented as true when they have any non-zero value (in help it is written so). How arrays are represented then? And why in this example there is a comparison "not equal to two", why exactly two, if any non-zero value is true, if there is no difference, if it was 1, why does it say exactly 2 ? Here is code from official example (from Moving Average 2009-2017 v1.00 line 132).
1. Is it true that any non-zero value is true when compared in the operators "==" , "!=" ?
2. How is an array represented? How can it be compared to a number at all?
3. Why is there a "2" in the comparison ? If according to the help truth is any non-zero value, then it is logical to write "1".
4. Did the condition if CopyRates got an error ?
Read carefully in documentation what function CopyRates() returns and you will understand everything.
Read carefully in the documentation what the CopyRates() function returns and you will understand.
I have purposely compiled this list of questions to get a detailed answer, not a one-syllable one and not another reference. If you want to help, please answer the questions in order.
Please clarify the situation with operators == and !=. If comparable variables are true when they have any non-zero value (the reference says so). How arrays are represented then? And why in this example there is a comparison "not equal to two", why exactly two, if any non-zero value is true, if there is no difference, if it was 1, why does it say exactly 2 ? Here is code from official example (from Moving Average 2009-2017 v1.00 line 132).
1. Is it true that any non-zero value is true when compared in the operators "==" , "!=" ?
2. How is an array represented? How can it be compared to a number at all?
3. Why is there a "2" in the comparison ? If according to the help truth is any non-zero value, then it is logical to write "1".
4. Did the condition if CopyRates got an error ?
CopyRates() returns int, not bool. Copy two bars (4th parameter) and check that 2 are copied.
I made this list of questions on purpose, to get a long answer, not a one-syllable one and not another bounce. If you want to help, please answer the questions in order.
Well, if you can't read it there, read it here:
Return value
Number of copied array elements or -1 in case of error.
Returns the number ofcopied elements. It is scheduled to get 2 elements and the query is set to 2. If the function returns any number except 2, something is wrong. And it has nothing to do with the array values.
CopyRates() returns int, not bool. Copy two bars (4th parameter) and check that 2 bars are copied.
About true and false. If they were compared like this: if(2){} or if(-1){} - then they are all true. But a comparison is performed for equality of two numbers x==2, so this expression may be true or false. If x equals 2, then true, otherwise false.
According to you 2==2 is true and for example 1234==2 is false. But the help says that any non-zero value in this operator is true, so 1234==2 is true.
Ward 6... Excuse me.
This is from the reference
It's from the reference.
Sorry again. Didn't have time to delete...
You can only answer "YES" or "NO".