Errors, bugs, questions - page 1904

 
Artyom Trishkin:

If there are multiple instances, why duplicate the same calculation in other instances of the same class?

Why do you need other instances if there is only one calculation?


Artyom Trishkin:
Andrey, could you be a bit more specific? I don't quite understand.

Better give a more detailed description of the problem, then the answer will be more concrete.

 
Artyom Trishkin:

The calculation is not unique - if there is a single instance of the class then the calculation should be, if there are multiple instances then why duplicate the same calculation in other instances of the same class? It takes resources.

At the same time, making another long cycle in the parent class to calculate this very data is not optimal either (we already have two long cycles), and the child class will not be self-sufficient then.

I suggested how to do what we need without duplication. We are not talking about descendants.
 

Good afternoon!

After 4 years I came back to one EA (bought it in 2013 and forgot about it). Decided to try it again. But now the system gives an error in one of the code lines. I guess something has changed in 4 years with Metatrader, because it was working fine before. I have no idea how to program, that is why I have bought Expert Advisor.) Can you tell me what the error may be.

Here is a part of the code

extern int Bperiod = 20; // Averaging period of the main indicator line.

extern int Bdeviation = 2; // Deviation from the baseline.

extern int Bshift = 0; // Shift of the indicator relative to the price chart.

extern int Baprice = 0; // CLOSE=0, OPEN=1, HIGH=2, LOW=3, MEDIAN=4, TYPICAL=5, WEIGHTED=6 .

extern string _6 = "========";

extern bool UseAutoDig = true; // If=true->external variables in points are multiplied by 10.

extern bool UseECN\NDD = true; // If=true->orders are set without stops, then modified.

The error is displayed at the last line of the

UseECN\NDD

command,

this command is repeated many times in the EA and an error occurs at every line with this commandExamples of

errors

'\' - illegal escape sequence e_plat2.mq4 49 22

'NDD' - semicolon expected e_plat2.mq4 49 23

'UseECN' - undeclared identifier e_plat2.mq4 144 6

'NDD' - undeclared identifier e_plat2.mq4 144 13

'NDD' - some operator expected e_plat2.mq4 144 13

'UseECN' - undeclared identifier e_plat2.mq4 172 6

'4206' - case value already used e_plat2.mq4 643 8


If you don't mind, what could be the reason?




 
platoshkasexy:

UseECN\NDD this command is repeated many times in the Expert Advisor and in each line where it is present, an error pops up

Replace throughout the code "UseECN\NDD" with "UseECN_NDD" (Ctrl+H)

 
Andrey Khatimlianskii:

Replace throughout the code "UseECN\NDD" with "UseECN_NDD" (Ctrl+H)


Thank you so much! Looks like it compiled!

I'll be testing...

 
Andrey Khatimlianskii:

Why are there any other instances if there is only one calculation?


You'd better give a more detailed description of the problem, then the answer will be more concrete.

The class has a loop that collects data on all orders and positions 1) in the account and 2) only those that match the m_symbol and m_magic filter.

As a result, once the loop is completed, we have data 1) on the entire account and 2) only on orders and positions belonging to the EA.

However, if an EA uses several symbols or magicians, we need to create instances of the class to gather statistics for each symbol/magic. Here is where the question arises: Why do we need to collect statistics (1) in these new instances that have already been collected on the very first instance of the class?

Hence the question - how inside the class to know if its instance is the only one, and hence we need to collect statistics 1, or, if the instance is not the only one, not to collect statistics 1, and give it out from the very first instance (here, too, it is not clear how inside the class, if it is not the only instance, to redirect the request to the very first instance of the class to give out statistics 1)

 
Artyom Trishkin:

The class has a loop that collects data on all orders and positions 1) in the account and 2) only those that match the m_symbol and m_magic filter.

As a result, once the loop is completed, we have data 1) on the entire account and 2) only on orders and positions belonging to the EA.

However, if an EA uses several symbols or magicians, we need to create instances of the class to gather statistics for each symbol/magic. Here a question arises: Why do we need to collect statistics (1) in these new instances, which have already been collected in the first instance of the class?

Hence the question - how inside the class to know that its instance is the only, and hence the need to collect statistics 1, or, if the instance is not the only, then do not collect statistics 1, and issue it from the very first instance (also still not clear how inside the class, if it is not the only instance, to redirect the request to the very first instance of the class to issue statistics 1)

1) Collect statistics for all mages/tools within one class. The list of mages should be specified during initialization and put into an array.

2) As already advised, make the results of statistics #1 static, and if they are available, don't start recalculation.

 
Artyom Trishkin:

The class has a loop that collects data on all orders and positions 1) in the account and 2) only those that match the m_symbol and m_magic filter.

As a result, once the loop is completed, we have data 1) on the entire account and 2) only on orders and positions belonging to the EA.

However, if an EA uses several symbols or magicians, we need to create instances of the class to gather statistics for each symbol/magic. Here is where the question arises: Why should we collect statistics (1) in these new instances, which have already been collected in the first instance of the class?

Hence the question - how inside the class to know if its instance is the only one, and hence need to collect statistics 1, or, if the instance is not the only one, not to collect statistics 1, and give it out from the very first instance (here also is not clear how inside the class, if it is not the only instance, to redirect the request to the very first instance of the class to give out statistics 1)

If English is not a problem - I have published an example of hypercube analysis in my blog. Go through the history once, then request information from the hypercube in the desired (different) slices. There are, of course, selectors both by magician and by symbol.
 
Artyom Trishkin:

Hence the question - how to know inside the class that its instance is the only one, which means you need to collect statistics 1, or, if the instance is not the only one, then don't collect statistics 1, and give it out from the very first instance

You have already been told:

Better yet, all the unique calculations should be put into a separate class and make it a singleton.

The first time a singleton is accessed, read the stats, then only retrieve them.


 

Developers, please explain why theOnTesterPass type event, when optimizing the number of variants greater than8.6e+18, is only called when creating a new generation?

And why is there not a single word about this feature in the Help file?

Why should I dig through half of an Expert Advisor to find an answer, why this function works properly in one EA, while in the other one it only writes optimization results in the file on a new generation?


How can I get around this limitation?

Reason: