Thanks, but can you tell me where the answer to my question is?
struct trade_settings
{
double take; // значения цены фиксации прибылиdouble stop; // значение цены защитного стопаuchar slippage; // значение допустимого проскальзывания
};
//--- создали и проинициализировали переменную типа trade_settings
trade_settings my_set={0.0,0.0,5};
if (input_TP>0) my_set.take=input_TP;
What's the problem, there are examples of assignment and getting value from structures.
struct test
{
int num;
double dval;
string sval;
};
test Test;
//...string field=DoubleToString(Test.dval);
What is the problem, there are examples of assignment and getting value from structures.
All you need to do is to convert double tostring. DoubleToString
What did you write and how does it solve my problem? I don't understand it.
And this was just an example. My structure has several fields of different types. And I don't know the field type, I only know the field name.
I have a string field name of the structure. I want, knowing this name, to request the corresponding field of the structure, i.e. get the value in this field.
Сериализация и десериализация JSON-протокола. Портированный код со скоростной библиотеки С++. Практичный пример: авторизация на сайте и парсинг ответа Благодарности принимаются в виде примеров, кто как применяет MQL для работы с веб-ресурсами. Поделитесь своим опытом работы с JSON в MQL. В протокол добавлены функции Escape / Unescape...
What did you write and how does it solve my problem? It's not clear.
And that was just an example. My structure has several fields of different types. And I don't know the field type, I only know the field name.
I have a string field name of the structure. I want, knowing this name, to query the corresponding field of the structure, i.e. get the value in this field.
//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
double d_value =0.0;
int i_value =0;
Print("d_value: type=",GetTypeName(d_value));
Print("i_value: type=",GetTypeName(i_value));
}
//+------------------------------------------------------------------+//| Возвращает в строковом виде тип |//+------------------------------------------------------------------+template<typename T>
string GetTypeName(const T &t)
{
return(typename(T));
}
That is, before reading the value of a variable, get its type and then read the value into a variable of the corresponding type.
The function calculates the trading criteria. The function returns the following values:
10- a trade criterion for opening a market Buy order has triggered; 20- trade criterion for opening a Sell order has triggered 11- trading criterion for closing a market Buy order triggered; 21- trading criterion for closing a Sell market order has triggered; 21 - market criterion for closing a Sell order has triggered;
Эта кроссплатформенная библиотека позволяет удобно осуществлять побайтовую работу со структурами, массивами и стандартными типами данных. Возможности Побайтовое сравнение (== и !=) между собой структур, массивов и стандартных типов данных (в MQL по умолчанию отсутствуют операторы сравнения структур) в любом сочетании. Определение байтового...
The function calculates the trading criteria. The function returns the following values:
10- a trade criterion for opening a market Buy order has triggered; 20- trade criterion for opening a Sell order has triggered 11- trading criterion for closing a market Buy order triggered; 21- trading criterion for closing a Sell market order has triggered; 21 - market criterion for closing a Sell order has triggered;
why is the program so locked into the return values?
This cycle is a multiple repetition. There is also a branching here. When the first condition triggers, operator return is executed and program execution stops. If the condition is false, the second condition is checked, and so on. If all 4 conditions are false, the following will be executed
How can I get the value of a field of a variable of structure type, knowing the sequence number of the field in that structure.
I know that field #1 (i.e. double) has changed value. How can I use the sequence number to find this field?
Or tell me how can I get the field of the structure knowing its string name?
here i have a value
string field="dval";
I want to query this particular structure field.
Or tell me, how can I get a structure field knowing its string name?
here i have a value
string field="dval";
I want to query this particular structure field.
Structures and, classes and interfaces
Structures and, classes and interfaces
Thanks, can you tell me where the answer to my question is in there?
Thanks, but can you tell me where the answer to my question is?
What's the problem, there are examples of assignment and getting value from structures.
You just need to convert double tostring. DoubleToString
What is the problem, there are examples of assignment and getting value from structures.
All you need to do is to convert double tostring. DoubleToString
What did you write and how does it solve my problem? I don't understand it.
And this was just an example. My structure has several fields of different types. And I don't know the field type, I only know the field name.
I have a string field name of the structure. I want, knowing this name, to request the corresponding field of the structure, i.e. get the value in this field.
you know, you're getting spoiled on the java.)
you need this.
https://www.mql5.com/ru/code/13663
What did you write and how does it solve my problem? It's not clear.
And that was just an example. My structure has several fields of different types. And I don't know the field type, I only know the field name.
I have a string field name of the structure. I want, knowing this name, to query the corresponding field of the structure, i.e. get the value in this field.
Look here, maybe this is what I need?
Forum on trading, automated trading systems and strategy testing
Can I define pyramid type programmatically ?
Anatoli Kazharski, 2015.06.17 17:07
Would you like to ask?
https://book.mql4.com/ru/build/conditions
The function calculates the trading criteria. The function returns the following values:
10- a trade criterion for opening a market Buy order has triggered;
20- trade criterion for opening a Sell order has triggered
11- trading criterion for closing a market Buy order triggered;
21- trading criterion for closing a Sell market order has triggered; 21 - market criterion for closing a Sell order has triggered;
return 10 20 11 21 возвращаемые значенияwhy is the program so locked into the return values?
Look here, maybe this is the right one.
And I have several fields of the same type. I don't think that's gonna help.
I found thishttps://www.mql5.com/ru/code/16282
I decided to pass its address (offset) in bytes instead of field name.
Would you like to ask?
https://book.mql4.com/ru/build/conditions
The function calculates the trading criteria. The function returns the following values:
10- a trade criterion for opening a market Buy order has triggered;
20- trade criterion for opening a Sell order has triggered
11- trading criterion for closing a market Buy order triggered;
21- trading criterion for closing a Sell market order has triggered; 21 - market criterion for closing a Sell order has triggered;
why is the program so locked into the return values?
This cycle is a multiple repetition. There is also a branching here. When the first condition triggers, operator return is executed and program execution stops. If the condition is false, the second condition is checked, and so on. If all 4 conditions are false, the following will be executed