SanNneK: Can you tell me what the condition is, if the chart went down by even one point, then all orders were closed?
The condition is less than or equal to. In ontik you assign the bid price to a global variable. If the bid is less than or equal to the global variable, then it closes the pending orders. Otherwise, the global variable equals the bid.
Is it possible to make predefined variables in a template function so that it is not possible to specify everything when calling it? A simple assignment will still give an error if not all variables are specified.
Для каждой выполняющейся mql5-программы поддерживается ряд предопределенных переменных, которые отражают состояние текущего ценового графика на момент запуска программы - эксперта, скрипта или пользовательского индикатора. Значение предопределенным переменным устанавливает клиентский терминал перед запуском mql5-программы на выполнение...
I can't explain how.... templates work it's roughly how - until such a function is called, the compiler knows nothing about its existence (often, there are even no compiler errors if there is no call)
then you call such a template function and the compiler fills the needed types and only then checks that everything will work properly
and then you make another call to the template with different types of parameters - and the compiler creates a new function, i.e. another one, i.e. as if you write 2 functions, which do the same thing, but with different types of parameters
whew, that's how it works ))))
UPD:
you can, but if the types in the template match, here's an example, it works correctly:
I can't explain how.... templates work it's like this - until you call such a function, the compiler knows nothing about its existence (often, there are even no compiler errors if there is no call)
then you call such a template function and the compiler fills the needed types and only then checks that everything will work properly
and then you make another call to the template with different types of parameters - and the compiler creates a new function, i.e. another one, i.e. as if you write 2 functions, which do the same thing, but with different types of parameters
Phew, so it goes ))))
And how do I know the type of input parameter?
If I pass a string type to a template and want to process it further.
The input parameters can be up to 64, any may have any type, how to determine that it is a string ?
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Can you tell me what the condition is, if the chart went down by even one point, then all orders were closed?
This way you can close all open trades (MQL4):
And if you want to selectively, you need to describe the selection condition.This way you can close all open trades (MQL4):
And if you want to selectively, you need to describe the selection condition.Thank you
2020.09.13 08:33:57.508 tst (EURUSD,H1) v1 = 1
2020.09.13 08:33:57.508 tst (EURUSD,H1) v2 = 1.01
2020.09.13 08:33:57.508 tst (EURUSD,H1) v3 = qwerty
2020.09.13 08:33:57.508 tst (EURUSD,H1) v4 = 3.1415
2020.09.13 08:33:57.508 tst (EURUSD,H1) v5 = 777
2020.09.13 08:33:57.508 tst (EURUSD,H1) v6 = 1
2020.09.13 08:33:57.508 tst (EURUSD,H1) v7 = 1.01
2020.09.13 08:33:57.508 tst (EURUSD,H1) v8 = qwerty
2020.09.13 08:33:57.508 tst (EURUSD,H1) v9 = 3.1415
2020.09.13 08:33:57.508 tst (EURUSD,H1) v10 = 777
2020.09.13 08:33:57.508 tst (EURUSD,H1) v11 = Value_11
Is it possible to make predefined variables in a template function so that it is not possible to specify everything when calling it? A simple assignment will still give an error if not all variables are specified.
Is it possible to make predefined variables in a template function
no,it can'T.
I can't explain how.... templates work it's roughly how - until such a function is called, the compiler knows nothing about its existence (often, there are even no compiler errors if there is no call)
then you call such a template function and the compiler fills the needed types and only then checks that everything will work properly
and then you make another call to the template with different types of parameters - and the compiler creates a new function, i.e. another one, i.e. as if you write 2 functions, which do the same thing, but with different types of parameters
whew, that's how it works ))))
UPD:
you can, but if the types in the template match, here's an example, it works correctly:
No,you can'T.
I can't explain how.... templates work it's like this - until you call such a function, the compiler knows nothing about its existence (often, there are even no compiler errors if there is no call)
then you call such a template function and the compiler fills the needed types and only then checks that everything will work properly
and then you make another call to the template with different types of parameters - and the compiler creates a new function, i.e. another one, i.e. as if you write 2 functions, which do the same thing, but with different types of parameters
Phew, so it goes ))))
And how do I know the type of input parameter?
If I pass a string type to a template and want to process it further.
The input parameters can be up to 64, any may have any type, how to determine that it is a string ?
How do I know the type of the input parameter?
If I pass a string type to a template and want to process it further.
There can be up to 64 input parameters and any of them can have any type, how can I know it is a string ?