Целый тип int x=100 / Целый тип int y=3 => Целое число 33.
Так как "А" - это вещественное число, то Целое число "33" преобразовывается к вещественному и получаем 33.0
This is an interesting feature. You go and search in the search engine but you don't find anything. When you ask a question in the forum and wait for an answer, you find it by yourself ))
Can you tell me why this might happen?
double A;
int x, y;
x=100; y=3; A=x/y=33,000
This is an interesting feature. You go and search in the search engine but you don't find anything. When you ask a question in the forum and wait for an answer, you find it by yourself ))
https://www.mql5.com/ru/articles/1561
Peculiarities of working with double numbers in MQL4
Please tell me, what can cause this?
double A;
int x, y;
x=100; y=3; A=x/y=33.000
as a rule, I guess:
Variables that are used in mathematical calculations, it is best to declare them as double
If these calculations use an incremental loop variable, we can use double y=y+1 or double y=y-1;
as a rule, I guess:
Variables that are used in mathematical calculations are best declared as double.
or double y=y+1 or double y=y-1;
There is also an explicit type conversion:
Hello.
Please tell me how to find a position with a certain lot among the open positions.
The symbol and the magic number are unknown. I need the following condition: if ( position's lot== 0.1) then {some action;}
Hello.
Can you please tell me how to find among the open positions a position with a certain lot.
The symbol and the magic number are unknown. I need about the following condition: if ( position's lot== 0.1) then {some action;}
Here is an example of a script that goes through all open positions and compares their volume to a given one (variable"lot"):
Here's an example of a script that goes through all open positions and compares their volume to a given one (variable"lot"):
Thank you, I'm sorry, I didn't specify, is there something similar for MQL4?
Thank you, I'm sorry, I didn't specify, is there something similar for MQL4?
No, no. And why, when there is MetaTrader 5 with netting and hedging and you can trade on real exchanges?
Here is an example of a script that goes through all open positions and compares their volume to a given one (variable"lot"):
Vladimir, can I ask how you envisage a position with a volume of 0.0 in this code?
Vladimir, can I ask how you envisage the 0.0 position in this code?