[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 204

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
Hi Allis! Print needs to be prescribed where there is no tick reading! I put in the print if there is an error, and if it opened, and so it is prescribed in the logbook that it opened, and only once!
Yes you are a Wizard)) Thank you!
You are a magician)) Thank you!
Good evening all. There is an indicator (upper in the figure) that draws its values (+1, 0, -1) on bar number 0, but the calculation is conducted by bar number 1. I need to write an indicator that would count the number of bars in each separate continuous block of +1 and -1 top indicator and the entire history (the average in the figure, the bar graph height in units corresponding to the number of bars).I have made an indicator (bottom in the figure), but it starts to be drawn only at the moment of installation in the window (blue vertical line).help who can!
Code
This is the remainder of the division! Look in the arithmetic steps and in your printer!
Put it in and you will only see the two results alternately:
I don't understand the logic. In the book I read:
If you want to calculate the remainder of division of variablea by variable band write the result to the variable ostatok, the assignment operator looks like this:
It turns out that in our case, whenMathRand() isdivided by 2, there should be a value of x equal to 0 or 1. Why should it be 0 or 1 all of a sudden? For example a random number 9 will appear. 9 % 2 = 4.5. The remainder of equals 4.Something I don't understand the logic of. In the book I read:
When something doesn't add up, it only takes a couple of clicks to answer...
P.S. ostatok = 9 % 2 = 1.
When something doesn't add up, it only takes a couple of clicks to answer...
P.S. ostatok = 9 % 2 = 1.
Well, it's written:
"Division with a remainder(modulo division,finding the remainder of division,the remainder of division) is anarithmeticoperation resulting in twointegers:an incomplete quotient andthe remainder of the division of a whole number by anotherinteger."
9 : 2 = 4.5 These are double numbers.
If you cut off the fractional part, it's 4. Where did you get 1?
It turns out that in our case, whenMathRand() isdivided by 2, the value of x must be 0 or 1. Why should it come out 0 or 1 all of a sudden? For example a random number 9 will appear. 9 % 2 = 4.5. The remainder of equals 4.There's something about the logic I don't understand. In the book I read:
Victor, don't confuse int with double! Soint x = MathRand() % 2; gives 0 or 1! It cannot give 0.1 or 0.9, neither 1.1 nor 1.9, because decimals in int are rounded and less than 0.5 are discarded! And the % sign means the remainder of the division, not the division sign. The division sign is /.
I put your example with 9 and get a single result, 1, because there is no random:
You ask:
9 : 2 = 4.5 These are double numbers.
If you discard the fractional part, you get 4. Where did you get 1?
I answer: So 0.5 is rounded to 1!
What's interesting, when I put a point and zero (2.0) to 2, the compiler gave me an error saying that % requires only an integer!
So even if you put double x, it still comes out an integer int. Thank you, Victor, for your doubts! Thanks to them and to you I made an interesting research, which will broaden my possibilities of mathematical transformations! I owe you a glass (virtual)! :))
Well, that's what it says:
"Division with a remainder(modulo division,finding the remainder of division,remainder of division) is anarithmeticoperation that results in twointegers:an incomplete quotient andthe remainder of the division of a whole number by anotherwhole number."
9 : 2 = 4.5 These are double numbers.
If you cut off the fractional part, it's 4. Where did you get 1?
What is the closest integer to 9 that is divisible by 2 without a remainder? Then subtract that number from the divisor (9). What did you get?
P.S. If you failed, you can print the result: Print ("ostatok = ", 9 % 2);
laveosa 07.03.2013 21:15
Hi. Can you tell me how to replace Symbol() with "EURUSD" in Ordersend() or what?
laveosa 07.03.2013 21:15
Hello. Can you tell me how to replace Symbol() with "EURUSD" in Ordersend() or what?