Algorithms, solution methods, comparison of their performance - page 13

 
Реter Konow:

2. integration into EA is the key point. If the solution is super-confusing (I'm sure you can't even explain how Sergey Dzyublik's solution works), what is its practical value to the trader? You can't build a normal EA out of super convoluted solutions.

The proposed solution was voiced immediately

But someone didn't even ask what it was. The implementation could have been much "clearer". But it wouldn't change the basis of the idea.

 
Реter Konow:

1. In terms of practice, these are empty words with which you fight the facts. I have shown the time measurement for finding the magician. I have demonstrated the convenience of integrating the solution into the EA. All you are demonstrating is a slander of my solution. Nothing else.

2. integration into EA is the key point. If the solution is super convoluted (I'm sure you can't even explain how Sergey Dzyublik's solution works), what is its practical value to the trader? You can't build a normal EA out of super convoluted solutions.

I am not judging Sergey Dzyublik's solution . He hasn't explained it yet. When he explains it, it will become clear who "started this mess".


Here I wanted to respond to you, but the moderator was ahead of you and said the same thing. So I'll show you again what he said:

Artyom Trishkin:

No. I'm not offering you someone else's solution style. Write in your own style - no one is imposing anything on anyone.

But I am suggesting that with your characteristic persistence you solve problems in the best possible way initially. What are you doing?

1. You initially choose the most suboptimal solution of all possible ones and start to play around with it. For this task, even at the stage of thinking out a solution, you had not only to reject your version, but even not to think in that direction. And that's not what the text handling functions are for.

2. About integration into the Expert Advisor and the benefits of the proposed solution - let the one who proposed it answer you.


P.S. You must be a very bad student :)

 
Реter Konow:

I realise my mistakes as soon as I am convinced of them. So far, no one has been able to prove my decision wrong. We'll wait.

You are a poor learner!

Forum on trading, automated trading systems and trading strategies testing

Algorithms, solution methods, performance comparison

Sergey Dzyublik, 2017.12.10 20:58


1. Your code does not work.
Incorrect pattern "_index_magic". Possible solution "|index_magic".


After addition we have _1_3_2_4_3_5_4_6_
Please find the 3rd in the list.
You will get the result 2.

string All_magics = "_1_3_2_4_3_5_4_6_";

int Get_magic(int deal_number)
{
 int stringlen = StringLen((string)deal_number); //добавлено
 //--------------------------------------------
 //Получаем начало строки магика.
 //--------------------------------------------
 int Magic_position_start =  StringFind(All_magics,"_" + (string)deal_number + "_",0) + stringlen + 2;
 //--------------------------------------------
 //Получаем конец строки магика.
 //--------------------------------------------
 int Magic_position_end   =  StringFind(All_magics,"_" + (string)(deal_number + 1) + "_",0);
 //--------------------------------------------
 //Получаем количество цифр из которых состоит магик.
 //--------------------------------------------
 int Magic_lenght         =  Magic_position_end - Magic_position_start;
 //--------------------------------------------
 //Извлекаем магик из общей строки.
 //--------------------------------------------
 string Magic             =  StringSubstr(All_magics,Magic_position_start,Magic_lenght);
 //--------------------------------------------
 //Возвращаем цифровое значение магика.
 //--------------------------------------------
 return((int)Magic);
}
//+------------------------------------------------------------------+


//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
  Print(All_magics);
  Print(Get_magic(3));   
}


Result

_1_3_2_4_3_5_4_6_
2
 
Artyom Trishkin:

So far all I see here is a mockery of a man who had the courage to post his solution here.

Clearly, it's... to put it mildly, it's rubbish at all. But he put it out there. The rest have so far only the courage to laugh and point the finger.

Artem, it took me 40 minutes of my time and a few million nerve cells to explain to the man that the substring..._25_... four characters, not three. Well, how many man-years do you think it will take us all to explain him something more conceptually valuable and powerful? I think a lot, a lot of man-years. That's why nobody even tries to explain and chew something up. There is simply a certain minimum level below which the one explaining cannot sink, and Peter's level is below that bar.

 
fxsaber:



Result

I've already said that the number of the magician is determined by the user. In order to avoid collisions within a string, you need to allocate a certain numeric range for magicians. For example from 100,000 to 999,000. Then there will be no problem.

That said, we can, of course, fine-tune the solution. This is only a "prototype". A demo version.

 
Vasiliy Sokolov:

Artem, it took me 40 minutes of my time and a few million nerve cells to explain to the man that the substring of ..._25_... four characters, not three. Well, how many man-years do you think it will take us all to explain him something more conceptually valuable and powerful? I think a lot, a lot of man-years. That's why nobody even tries to explain and chew something up. There is simply a certain minimum level below which the one explaining cannot sink, and Peter's level is below that bar.

Vasily, I understood everything as soon as you said it. Thank you for finding that mistake.

 
fxsaber:

Fuck you.

Here we go...))

And why the reaction?

 

The standard container from the library - CArrayList - was chosen to solve the task.
Almost all code is a wrapper in order to provide a "convenient" interface for testing. For every taste and colour as they say....

To test your solution you need:
1. Create a class that inherits from ITestRandomAccessCollection and implements the necessary methods. (similar toTestRandomAccessCollectionCArrayList)
2. Data of a certain type is used for testing. In the example was int.
We need to make sure that there is a generator for the selected data type and it is added toCreateGenerator(similar toIntGenerator).
3. Run a test on the same data for several solutions and compare the results (if you want, you can also cycle to get the average):

{
     printf ("TestRandomAccessCollectionAfterAdding: Started.", result);
     TestRandomAccessCollectionCArrayList<int> testCollection();
     result = TestRandomAccessCollectionAfterAdding(testCollection, 10000, 1);
     printf ("TestRandomAccessCollectionAfterAdding: Fineshed. Total result: %I64i\n", result);
}


This is currently the function for testing, new ones may be added by analogy:

template<typename T>
ulong TestRandomAccessCollectionAfterAdding(ITestRandomAccessCollection<T> &testCollection, const int iterationCount = 1000, int srandValue = 0)

Parameters:

testCollection - test container implementingITestRandomAccessCollection<T>;
iterationCount - number of iteration cycles in the test;
srandValue - influence on the sampling from the generator if 0 is a random sampling.

 
Реter Konow:
1. How many microseconds on average does it take to find the magician in your solution?

2. How easy is it to integrate your solution into the EA (in your opinion)?


1. it makes no sense. The algorithms as a whole are compared on relative results.
2. The solution is already integrated - it's a standard library<Generic\ArrayList.mqh>.

 
Реter Konow:

As I said before, the magician number is determined by the user. In order to avoid collisions within a string, you need to allocate a certain numeric range for the magicians. For example from 100,000 to 999,000. Then there won't be any problem.

That said, you can, of course, refine the solution. This is just a "prototype". It is a demo version.


My dear, what you want is a childish task. It's the kind of problem schoolchildren solve.

There are dozens of them on the internet. And forget about the string data.