Any questions from a PROFI to a SUPER PROFI - 1. - page 21

 
Showed you how. The post has been corrected.
 
I see, thank you.
I guess I can forget about full-fledged work with MySQL in MQL (without my dlls)... pity...
 

What's not to like about the library?

In the case of a pointer return, it needs to be static and in the same process.

 
Zhunko:

What's not to like about the library?

If you make your own dll, it makes no sense to break part of the code into MQL and part into the libe. all MySQL will go inside this dll.

 
Hello all. Any advice? VPS Windows Web Server 2008 32 bit - not R2 (RAM 256) - will it work for MT4 ?
 
sergeev:

If you make your own dll, it makes no sense to break part of the code into MQL and part into lib. all of MySQL will go inside this dll.

Of course! You don't have to write in MQL at all, if you can. Almost everything is in the DLL. Starting to transfer everything to my application. I will manage the terminal remotely.
 

Algorithm of fractions enumeration

I). It is required to find an algorithm for enumerating fractions, so that:

A + B + C + n + ... = 100%

Each element from the set {A, B, C, n} must have standard criteria: maximum and minimum side constraints and incremental step of type: start, stop, steep;

An example of the problem:

Given a set

Y{A,B,C,n};

Each element of such set can be varied from -100% to +100%, in steps of 10%. The sum of all elements modulo must equal 100%: A+B+C+n=100%.

Find a matrix D(x,number_of_elements_ multiples_Y) that describes the distribution of all possible fractions between A, B, C, n, e.g:

A B C

100 0 0

90 10 0

90 0 10

80 10 10

80 0 20

...

Examples of incorrect finding:

A B C

-50 30 120 - element C is greater than the limit of 100%

35 30 35 - the step is not equal to 10%

70 30 10 - sum not equal to 100%

-50 60 90 - sum of all elements modulo not equal 100% (50+60+90=200)

II*). Find solution of search of fractions for set N with MT5/MT4 optimizer so that constraints of each element of the set could be set with standard constraints Start, Step, Stop.

 


As an introductory note, here is an algorithm which implements a special case of the problem:

//+------------------------------------------------------------------+
//|                                                  Optimizator.mq5 |
//|                        Copyright 2011, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2011, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   int A, B, C;
   int handle = FileOpen("test.csv",FILE_WRITE,'\t');
   for(A=0; A<=100;A+=10)
   {
      for(B=0;B<=100-A;B+=10){
         C=100-(A+B);
         FileWrite(handle,A,B,C);      
      }
   }
   FileClose(handle);
  }
//+------------------------------------------------------------------+

As you can see, each element of the set, except the last, requires an additional for loop. This is not a good solution, because as you change the number of elements in the set, you have to insert or delete additional loops.

 
C-4:


As an introductory note, here is an algorithm that implements a special case of the problem:

As you can see, each element of the set, except for the last one, requires an additional for loop. This is not a good solution, because as you change the number of elements in the set, you have to insert or delete extra loops.


Do just one while loop for one of A or B or C.

Within it, analyze if for gaps

 
sergeev:

do just one while loop on one of A or B or C.

Within it, analyse if for gaps to be reached


The point is that still B and C will be combined with each other, and you need a new loop for that. Perhaps this problem can be solved recursively, although there may be simpler algorithms.