Библиотеки: Input_Struct - страница 3

 
Previously, I used to place the input parameters in a separate file. In  Input_Struct.mqh , I included that input parameter file based on whether the macro definition was present. Different EAs defined different macros to include the corresponding file. This way, I didn't need to copy the file, but the downside was that I had to write the parameter definitions twice.
 
hini #:
do I need to copy a new  Input_Struct.mqh  file every time I create a new EA? Can I use a shared file instead?

В моих ООП-советниках каждый модуль имеет свои входные параметры. Поэтому для каждого модуля у меня идет соответствующая копия оригинального файла с нужными правками верхних строк.

Т.е. я подключаю сразу несколько mqh-файлов с входными параметрами.


Однако, если вы хотите всегда использовать только один файл, то это предусмотрено изначально и реализовывается через переименовывание.

Но такой вариант использования имеет ограничения. В частности, нельзя будет задавать sinput/group и отличные от int/double/bool входные параметры.

Я бы рекомендовал создавать свою копию. Это и логично, т.к. каждый советник имеет свой mq5-файл. Логично, что его входные параметры должны быть в своем mqh-файле.

 
fxsaber #:

Я бы рекомендовал создавать свою копию. Это и логично, т.к. каждый советник имеет свой mq5-файл. Логично, что его входные параметры должны быть в своем mqh-файле.

Thank you, I still prefer to use just one file. I will use different macro definitions to include each EA's own  Input.mqh .

 
Author, I have used several of your libraries. You are truly a genius, and I appreciate your creativity!
 
hini #:
Previously, I used to place the input parameters in a separate file. In  Input_Struct.mqh , I included that input parameter file based on whether the macro definition was present. Different EAs defined different macros to include the corresponding file. This way, I didn't need to copy the file, but the downside was that I had to write the parameter definitions twice.

Если вы будете использовать INPUT_STRUCT_ADDON, то вам не понадобится прописывать входные параметры дважды.

hini #:

Thank you, I still prefer to use just one file. I will use different macro definitions to include each EA's own  Input.mqh .

Я бы делал иначе.

 
fxsaber #:

Если вы будете использовать INPUT_STRUCT_ADDON, то вам не понадобится прописывать входные параметры дважды.

Thank you very much, everything is perfect now.

 
#define HGROUP(NAME)                                           // hide group
#define HINPUT(NAME, TYPE, DEFAULT) MACROS(NAME, TYPE, DEFAULT) // hide input

#define HINPUT(A, B, C)                                                                                             \
    B MACROS_INPUT2(A) = (B)(C);                                                                                    \
    const bool MACROS_INPUT1(A) = ::Set_INPUT_STRUCT(MACROS2(TYPENAME_INPUT).MACROS_INPUT3(A), MACROS_INPUT2(A)) && \
                                  ::Set2_INPUT_STRUCT(inInputsAll, MACROS_INPUT4(A) + " = " +                       \
                                                                   (string)(MACROS_INPUT2(A)));
I added two macro definitions that I think are quite practical. They temporarily hide the input parameters instead of disabling them.
 
hini #:
I added two macro definitions that I think are quite practical. They temporarily hide the input parameters instead of disabling them.

У меня был прописан такой сценарий.

// Copy-Paste update from here:

// INPUT_STRUCT_ADDON / INPUT_STRUCT_ADDON_WITHOUT_FILENAME
#define DINPUT(NAME, TYPE, DEFAULT)                             // disable input
#define _INPUT(NAME, TYPE, DEFAULT)                             // input without struct
#define SINPUT(NAME, TYPE, DEFAULT) MACROS(NAME, TYPE, DEFAULT) // sinput
#define  INPUT(NAME, TYPE, DEFAULT) MACROS(NAME, TYPE, DEFAULT) // input
#define  GROUP(NAME)                                            // group

Но я забыл его тело включить в исходник.

Для группы подобное специально не делал, потому что так меньше вероятность забыть, что скрыл какие-то входные параметры.

 
fxsaber #:
Но я забыл его тело включить в исходник.

Then add it

 

I have used 'DINPUT', and I found it does not meet my requirements. 'DINPUT' does nothing and does not have that member variable in InputStruct.

I need to temporarily hide it. I need to use variables like inInputs.XXXX, but I don't want to provide XXXX as input for the tester。


There is a scenario where certain external input parameters that control EA behavior are hidden when made public, but need to be controlled for personal use!

DINPUT and HINPUT are different targets