Questions from Beginners MQL5 MT5 MetaTrader 5 - page 443

 
Karputov Vladimir:
So it's worth adding more prints and seeing where the algorithm goes.
So when you change the TF they are there - I don't know where else to add more printers there....
 

Installed 880 build of MT4 - compiles without errors, but terminal crashes (old build works correctly).

After starting another terminal and compiling there - under old build, I start terminal with new build and get error when trying to change EA (invoke editor) 2015.09.19 22:23:11.272 MetaEditor not found - start in terminal mode

Errors when launching the EA

2015.09.19 22:29:49.948 2014.01.20 21:30 Kamikadze_MA_V_04_42_Fibo_04.ex4 GBPUSD,M15: OrderSend error 4051

2015.09.19 22:29:49.948 2014.01.20 21:30 Kamikadze_MA_V_04_42_Fibo_04.ex4 GBPUSD,M15: invalid amounts for OrderSend function


 
-Aleks-:

Installed 880 build of MT4 - compiles without errors, but terminal crashes (old build works correctly).

After starting another terminal and compiling there - under old build, I start terminal with new build and get error when trying to change EA (invoke editor) 2015.09.19 22:23:11.272 MetaEditor not found - start in terminal mode

Errors when launching the EA

2015.09.19 22:29:49.948 2014.01.20 21:30 Kamikadze_MA_V_04_42_Fibo_04.ex4 GBPUSD,M15: OrderSend error 4051

2015.09.19 22:29:49.948 2014.01.20 21:30 Kamikadze_MA_V_04_42_Fibo_04.ex4 GBPUSD,M15: invalid lots amount for OrderSend function


А

#property strict
do you put it in your code?
 
Karputov Vladimir:

А

Put it in your code?
Yes - of course! Had to roll back to 840 build - it works more correctly.
 
Please tell me how to create a global variable with variable name generation - it should be "Variable name_Magic number".
 
-Aleks-:
Please tell me how to create a global variable with variable name generation - it should be "Variable name_Magic number".
You can do this, or you can be guided by:Variables
 
Karputov Vladimir:
You can do this, or you can be guided by:Variables
I don't understand the answer - let me clarify my question. I have code, where there is an external variable Magic - its value is set by user, I need to ensure the relative stability of the system after turning on/off the terminal, because there is some algorithm inside the program that does statistical calculation and its last value is important for algorithm's start. I decided to take a global variable for storing calculation data but it should be bound to a certain EA - it would be logical to bind it with magic - thus obtaining "global variable name+Magic" variable name. So the question is, how to generate a new variable name correctly?
 
-Aleks-:
I don't understand the answer - let me clarify the question. I have code, where there is an external variable Magic - its value is set by user, I need to ensure the relative stability of the system after enabling / disabling the terminal, because there is some algorithm inside the program that does statistical calculations and its last value is important for running the algorithm. I decided to take a global variable for storing calculation data but it should be bound to a certain EA - it would be logical to bind it by magic - thus obtaining "global variable name+Magic" variable name. So the question is, how to generate a new variable name correctly?

Stability and an external variable that can be edited by the user are already incompatible conditions. Example: the first run - the user has changed the external variable, you have bound to this prefix in your code. Terminal restarts and user changes external variable again. What will you do?

In your algorithm, the last calculated value (the one that is very important after the restart) - what type is it? Double? If it is not, there will be problems.

 
Karputov Vladimir:

Stability and an external variable that can be edited by the user are already incompatible conditions. Example: the first run - the user has changed the external variable, you have bound to this prefix in your code. Terminal restarts and user changes external variable again. What will you do?

In your algorithm, the last calculated value (the one that is very important after the restart) - what type is it? Double? If not, there will already be a problem.

Well, the user is me, so it's not supposed to change anything frantically. What other options are there? In init put recalculation and search for the right value?

The variable is int, but you can use double - it is not important - it will store integers.

 
-Aleks-:
... Because inside the program there is an algorithm that performs statistical calculation and its last value is important for running the algorithm. I decided to take a global variable for storing calculation data but it should be bound to a certain EA - it would be logical to bind it with magic - in this way, the variable name "name of global variable+Magic" will be generated. So the question is, how to generate a new variable name correctly?

What's wrong with that? :

   string strText="rezult";
   string strGlobalVariableName=strText+"_"+inpMagic;
Reason: