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

 
fxsaber:

There is a clear pattern of repeated disrespect for the community and a clear pattern of provocation.

Not reading it (a person's posts in various constructive threads) is not always possible, after which to develop and forget it - even less so.

Trolling and spitting in the hands of help, the number of which greatly distinguishes this resource from the positive side.


Could be wrong.

Control your emotions please. If you don't accept someone else's point of view, you can choose not to participate in the discussion. No one is forcing you to.

 
Vladimir Karputov:

Correct me, but isn't string length finite?

https://msdn.microsoft.com/ru-ru/library/sx08afx2.aspx

I can't find this limitation for MQL5...

A string is basically a uchar array, with its own special features like automatic repartitioning. That's why the string length is not limited at least in an explicit way, neither is the array size. But very long string may potentially run out of memory, as evidenced by specific error code like ERR_STRING_RESIZE_ERROR (Insufficient memory to reallocate string).


 
Vasiliy Sokolov:

A string is essentially a uchar array, with its own benefits, such as automatic repartitioning. Therefore string length is not limited at least explicitly, neither is array size. But very long string may potentially run out of memory, as evidenced by specific error code like ERR_STRING_RESIZE_ERROR (Not enough memory to reallocate string).


Valuable information for me too. Thank you.
 
fxsaber:

Memory restriction only

obviously a length type restriction, i.e. next to INT_MAX
 
Реter Konow:

1. that is, the speed of the algorithm is not important. The solution is "conceptually-powerful" and that's enough. Ok.

2. So, you just plug in via the plug-in and that's it? Ok.

//--------------------------------------------------------------------

If the main criterion for evaluating the algorithm is"Conceptually Powerful", then I've lost.

If the main criterion for judging the algorithm - simplicity, speed and convenience - I win.

We can close the topic at this point.


You can still speed up and simplify "your algorithm" (and you are constantly told about it), if you replace the string with two int[] of the same size and store the number of transaction in one, and in the other magician and look for the needed index of magician on the corresponding search of the array of transactions. It will be faster. Of course, this is a special case that follows from your example.

Peter learnt arrays and understood that they are universal and powerful tools, then he started to learn strings... Can you imagine what will happen when he will learn about structures?)

Piotr substitute these functions in his example:

struct SDealMagic {int deal,magic;} array[];
//
void Trading()
{
   Random_orders_of_strategy=MathRand();
   ArrayResize(array,Random_orders_of_strategy);
   for(int i=0; i<Random_orders_of_strategy; i++)
   {
      array[i].deal=i;
      array[i].magic=MathRand()
   }
}
//
int Get_magic(int deal_number)
{
   for(int i=0; i<Random_orders_of_strategy; i++)
      if(array[i].deal==deal_number) return(array[i].magic);
   return(-1);
}

And speed will take the pattern :)

 
Реter Konow:

1. that is, the speed of the algorithm is not important. The solution is "conceptually-powerful" and that's enough. Ok.

2. So, you just plug in via the plug-in and that's it? Ok.

//--------------------------------------------------------------------

If the main criterion for evaluating the algorithm is"Conceptually Powerful", then I've lost.

If the main criterion for evaluating the algorithm - " Simplicity, speed and convenience " - I win.

At this point we can close the subject.


Just an example shows the most common - that is, a lot of extra information, at least the debug handler and define on the print is absent - or else it would have added another 300 lines.

At least the whole code is completely....

the part of the code you need to add and call through the library will be much more convenient, less coded and more readable

 
Alexandr Andreev:

The ticker with a majik - it should be saved and then it can be sent to the ticker or majik in a convenient form.

In fact, the fastest solution would be to store all the information in the structure. But the accesses will be made through ordered reference index sammiva.

This is a head-on solution and therefore not the quickest. It would be better to do it via HashMap. However, we wouldn't need a structure in the current implementation, but rather a class inherited from a certain interface to describe the fields of its orders.

 
Yury Kulikov:

You can speed up and simplify "your algorithm" (and they keep telling you about it), if you replace string with two int[] of the same size and store transaction number in one and magik in the other and search for necessary index of magik by corresponding enumeration of array of transactions. It will be faster. Of course, this is a special case that follows from your example.


This is an interesting and useful proposal. Maintaining parallel records. I did it in my other solutions.

The only thing is we do not know the number of orders the EA will place initially. What size should we set for the int array?

That is why I decided to use a string.

 
fxsaber:

This is a head-on solution and therefore not the quickest. It is better to do it through HashMap. But the current implementation would not require a structure, but a class inherited from a certain interface to describe the fields of its orders.


I haven't found theGeneric file, it seems that this is an old build. So, how will the navigation principle be provided - what is the source code?

 
Реter Konow:

It is an interesting and smart suggestion. Maintaining parallel records. I've done it in my other solutions.

The only thing we don't know is the number of orders which will be placed by the Expert Advisor. What size should we set for the int array?

So I decided to take a string.

Peter, there is a great function called ArrayResize(). It allows you to increase the size of an array at the moment of program execution.