Errors, bugs, questions - page 2729

 
Alexey Viktorov:

This is not a feature of mql5, it's just some attempts to teach order.

order accustoming is when the compiler gives a warning (or error). converting integers to fractions returns 0 - this is nonsense, not order. 90% of old codes will break that way.

and notice, the working variant was still with int! i.e. the issue is not about type conversion at the substitution step, but at the calculation step

ADDED: switched to MQ-demo, updated the working terminal. It doesn't have this problem.

 
Compilation error
class A {  
public:
        static int i;
} a; //Error: unresolved static variable 'A::i'
int A::i = 0;
 
Igor Zakharov:

ordering is when the compiler gives a warning (or error). converting integers to fractions returns 0 - this is nonsense, not order. this is how 90% of old codes break.

and notice, the working variant was still with int! i.e. the issue is not about type conversion at the substitution step, but at the calculation step

ADDED: switched to MQ-demo, updated the working terminal. It doesn't have this problem.

Is the lack of highlighting of possible options in this case not suspicious?

   ObjectSetDouble (0,name,OBJPROP_ANGLE,dir// тут должен появиться список вариантов переменных double
 
Error during execution
class A {  
public:
         A() { i = ++ii; printf( "%d", i ); }
        ~A() {           printf( "%d", i ); }
        int i;
        static int ii;
};
int A::ii = 0;
A a[ 2 ];
void OnStart() {}

  • The result in MQL: 1212
  • and in C++: 1221
 
Alexey Viktorov:

Is the lack of highlighting of possible options in this case not suspicious?

:)

 
Igor Zakharov:

:)

Yes... Strange, for a while back variables of inappropriate type weren't highlighted. Maybe they fixed it on purpose or will pay attention to this dialog and fix it again. Anyway, if the function requires variable type double, double should be used.

 
It's always been a mistake.
#define  MACRO( X, Y )
MACRO( 1, 2, 3) //Warning: too many arguments for function-like macro 'MACRO'
Why a warning? Especially since they are always in excessive numbers and you don't pay attention sometimes
 
Alexey Viktorov:

Yes... Strange, for a while back variables of an inappropriate type weren't highlighted. Maybe they fixed it on purpose or will pay attention to this dialog and fix it again. Anyway, if the function requires the variable's type double, double should be used.

Alexei, I notice you like links to documentation, I have one for you :)

https://www.mql5.com/ru/docs/basis/types/casting

int to double is a valid implicit conversion without data loss. legitimate.

Документация по MQL5: Основы языка / Типы данных / Приведение типов
Документация по MQL5: Основы языка / Типы данных / Приведение типов
  • www.mql5.com
Часто возникает необходимость преобразовать один числовой тип в другой. Не каждый числовой тип допустимо преобразовать в другой, допустимые преобразования в MQL5 показаны на схеме: Сплошные линии со стрелками обозначают преобразования, которые выполняются без потери информации. Вместо типа char может выступать тип bool (оба занимают в памяти 1...
 

question about the operation of the strategy tester.

I am running the test. The Expert Advisor opens a position with SL and TP. Then it rolls and the position is closed without being reopened.

What is it? A bug? I have not used the tester for some time and it did not have such problems. Below is the log from the tester. We see that the position has been opened and closed after rollover and then it is kind of written that it has been opened via BUY. I pasted in the tester the command

PositionSelect(_Symbol) to check if there are open positions after the rollover, the result is always the same - no open positions.


2020.04.28 18:14:14.609 2014.01.09 05:00:00 instant buy 1.00 AUDUSD at 0.88800 sl: 0.88450 tp: 0.89200 (0.88750 / 0.88800 / 0.88750)

2020.04.28 18:14:14.609 2014.01.09 05:00:00 deal #8 buy 1.00 AUDUSD at 0.88800 done (based on order #8)

2020.04.28 18:14:14.610 2014.01.09 05:00:00 deal done [#8 buy 1.00 AUDUSD at 0.88800

2020.04.28 18:14:14.610 2014.01.09 05:00:00 order performed buy 1.00 at 0.88800 [#8 buy 1.00 AUDUSD at 0.88800


2020.04.28 18:14:24.169 2014.01.09 23:59:59 deal #9 sell 1.00 AUDUSD at 0.88980 done (based on order #9)

2020.04.28 18:14:24.169 2014.01.09 23:59:59 rollover deal done [#9 sell 1.00 AUDUSD at 0.88980

2020.04.28 18:14:24.170 2014.01.09 23:59:59 deal #10 buy 0.00 AUDUSD at 0.8899950 done (based on order #10)

2020.04.28 18:14:24.170 2014.01.09 23:59:59 rollover deal done [#10 buy 0.00 AUDUSD at 0.8899950]


 
Igor Zakharov:

Alexei, I notice you like links to documentation, I have one for you :)

https://www.mql5.com/ru/docs/basis/types/casting

int to double is a valid implicit conversion without data loss. legitimate.

I link to the documentation so that I don't have to rewrite the documentation in the post and so that people get used to reading the documentation. Imagine there have been people here on the forum who didn't know that documentation existed at all. As for me personally, I've seen such a picture in the documentation, but didn't try to understand it thoroughly. The habit of using variables of the type the function requires is enough for me. As a last resort, I will force conversion to the right type.