Errors, bugs, questions - page 2441

 
Sergey Dzyublik:

Maybe MD5 from ex5 file?
Maybe stored inside ex5 file, search with hex editor...

So need to get some kind of hash sum of itself through MQL5.

 
 SSASultonov.mqh |
//|                                            Copyright 2018, IgorM |
//|                              https://www.mql5.com/ru/users/igorm |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, IgorM"
#property link      "https://www.mql5.com/ru/users/igorm"
#property version   "1.00"
#property strict

double FactorialsTable[21]=
  {
   1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,87178291200,1307674368000,
   20922789888000,355687428096000,6402373705728000,121645100408832000,2432902008176640000
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
class CSSASultonov
  {
private:
   int               mcountSLAE;
   int               mdigits;
   double            Cx[],Cx2[],V1x[],C2xy[],C2xx[],V2xx[],C3xxy[],C3xxx[],V3xxx[];
   int               mSumN;
   double            calcV(int index);
   double            calcxx(int index1,int index2,int shift);
   double            Factorial(const int n);
public:
                     CSSASultonov(int countSLAE,int digits);
                    ~CSSASultonov();
   void              SSA(int shift);
   double            a[5];
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
CSSASultonov::CSSASultonov(int countSLAE,int digits)
  {
   mcountSLAE=countSLAE;
   mdigits=digits;
   ArrayResize(Cx,mcountSLAE);
   ArrayResize(Cx2,mcountSLAE);
   ArrayResize(V1x,mcountSLAE);
   ArrayResize(C2xy,mcountSLAE);
   ArrayResize(V2xx,mcountSLAE-2);
   ArrayResize(C3xxy,mcountSLAE-2);
   ArrayResize(C3xxx,mcountSLAE-2);
   ArrayResize(V3xxx,mcountSLAE-3);
   mSumN=0;
   for(int i=1; i<=mcountSLAE; i++) mSumN+=i;
   int n=mcountSLAE-1;
   int size_cxx=(int)(Factorial(n)/((Factorial(n-2))*2));
   ArrayResize(C2xx,size_cxx);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
CSSASultonov::~CSSASultonov()
  {
  }
//+------------------------------------------------------------------+
double CSSASultonov::calcxx(int index1,int index2,int shift)
  {
   double result=0.0;
   for(int i=0;i<mcountSLAE; i++)
     {
      result+=NormalizeDouble(Open[index1+i+shift],mdigits)*NormalizeDouble(Open[i+shift+index2],mdigits);
     }
   return(result);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double CSSASultonov::calcV(int index)
  {
   return(NormalizeDouble((-0.5+sqrt(0.25+2.0 *mSumN))*Cx2[index]-Cx[index]*Cx[index],8));
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
CSSASultonov::SSA(int shift)
  {
   int i,j;
   double open;
   ZeroMemory(a);
   ZeroMemory(Cx);
   ZeroMemory(Cx2);
   ZeroMemory(V1x);
   ZeroMemory(C2xy);
   ZeroMemory(C2xx);
   ZeroMemory(V2xx);
   ZeroMemory(C3xxy);
   ZeroMemory(C3xxx);
   ZeroMemory(V3xxx);
// формулы   27 - 35 суммы столбцов:
// AI = Cx[0]  AJ = Cx[1] AK = Cx[2] AL = Cx[3] AM = Cx[4]
   for(i=0;i<mcountSLAE; i++)
     {
      for(j=0;j<mcountSLAE; j++)
        {
         open=NormalizeDouble(Open[j+i+shift],mdigits);
         Cx[i]+=open;
         Cx2[i]+=open*open;
        }
      //AB - AE        
      //V(x1)   V(x2)   V(x3)   V(x4)
      V1x[i]=calcV(i);
     }
// формулы   17 - 26
   int countcxx=0;
   for(i=0;i<mcountSLAE; i++)
     {
// AF- AI
//C(x1y)        C(x2y)  C(x3y)  C(x4y)    
      C2xy[i]=NormalizeDouble((-0.5+sqrt(0.25+2.0 *mSumN))*calcxx(i,mcountSLAE-1,shift)-Cx[i]*Cx[mcountSLAE-1],8);
      for(j=i;j<mcountSLAE-2; j++)
        {
// AJ - AO       
//C(x1X2)       C(x1x3) C(x1x4) C(x2x3)=20      C(x2x4)=21      C(x3x4)=22         
         C2xx[countcxx]=NormalizeDouble((-0.5+sqrt(0.25+2.0 *mSumN))*calcxx(i,j+1,shift)-Cx[i]*Cx[j+1],8);
         countcxx++; // 0 = x1x2 (17) , 1 = x1x3 (18) , 2 = x1x4 (19) , 3= x2x3 (20) , 4 = x2x4 (21) , 5 = x3x4 (22)
        }
     }
// формулы   14,15,16
// AV - AX
// V(x1x2)=V2=14        V(x1x3)=15      V(x1x4)=16
   for(i=0;i<ArraySize(V2xx); i++) V2xx[i]=V1x[0]*V1x[i+1]-C2xx[i]*C2xx[i];
// формулы   11,12,13
// AS - AU
//C(x1x2y)=13   C(x1x3y)=12     C(x1x4y)=11
   for(i=0;i<ArraySize(C3xxy); i++) C3xxy[ArraySize(C3xxy)-i-1]=V1x[0]*C2xy[i+1]-C2xx[i]*C2xy[0];
// формулы   6,7,8
// AP - AR
// C(x1x2x3)=8  C(x1x2x4)=7     C(x1x3x4)=6
   C3xxx[0] = V1x[0]*C2xx[5] - C2xx[1]*C2xx[2];
   C3xxx[1] = V1x[0]*C2xx[4] - C2xx[0]*C2xx[2];
   C3xxx[2] = V1x[0]*C2xx[3] - C2xx[0]*C2xx[1];
// формулы   9,10
// AY - AZ
//V(x1x2x3)=V3=10       V(x1x2x4)=9
   V3xxx[0] = V2xx[0]*V2xx[2] - C3xxx[1]*C3xxx[1];
   V3xxx[1] = V2xx[0]*V2xx[1] - C3xxx[2]*C3xxx[2];
// формулы   3,4,5

// BC
// C(x1x2x4y)=3
   double Cx1x2x4y   = V2xx[0]*C3xxy[0] - C3xxy[2]*C3xxx[1];
// BA
// C(x1x2x3x4)=4
   double Cx1x2x3x4  = V2xx[0]*C3xxx[0] - C3xxx[2]*C3xxx[1];
// BB
// C(x1x2x3y)=C3=5
   double Cx1x2x3y   = V2xx[0]*C3xxy[1] - C3xxy[2]*C3xxx[2];
// формулы   1,2
// BE
// V(x1x2x3x4)=V4=2
   double Vx1x2x3x4 = V3xxx[1]*V3xxx[0] - Cx1x2x3x4 * Cx1x2x3x4;
// BD
// C(x1x2x3x4y)=C4=1
   double Cx1x2x3x4y= V3xxx[1]*Cx1x2x4y - Cx1x2x3x4 * Cx1x2x3y;
// расчет а   
   a[4] = Vx1x2x3x4!=0.0 ? Cx1x2x3x4y / Vx1x2x3x4 : 0.0;
   a[3] = V3xxx[1]!=0.0  ? (Cx1x2x3y - a[4]*Cx1x2x3x4) / V3xxx[1] : 0.0;
  
   a[2] = V2xx[0]!=0.0   ? (C3xxy[2] - a[3]*C3xxx[2] - a[4]*C3xxx[1])/V2xx[0] : 0.0;
   a[1] = V1x[0]!=0.0    ? (C2xy[0] - a[2]*C2xx[0] - a[3]*C2xx[1] - a[4]*C2xx[2])/V1x[0] : 0.0;
   a[0] = (Cx[4] - a[1]*Cx[0] - a[2]*Cx[1] - a[3]*Cx[2] - a[4]*Cx[3])/mcountSLAE;
/*
   Print("a[4] = ",a[4]);
   Print("a[3] = ",a[3]);
   Print("a[2] = ",a[2]);
   Print("a[1] = ",a[1]);
   Print("a[0] = ",a[0]);
*/
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double CSSASultonov::Factorial(const int n)
  {
   if(n<0) return(0);
   if(n<=20) return(FactorialsTable[n]);
   else
     {
      double val=FactorialsTable[20];
      for(int i=21; i<=n; i++) val*=i;
      return(val);
     }
  }
//+------------------------------------------------------------------+

How do I add the indicator code to my article? Will this work?
 
Please help me how to insert the code of the indicator into the article, which is shown in the attachment.
Files:
MQL4.zip  122 kb
 
fxsaber:

So you need to get some kind of hash sum of yourself through MQL5.

To solve the problem, first you need to understand the problem, i.e. find what kind of hash it is.
To do that, we need to have an opt file from a certain ex5 and then decompress the opt file according to the given structures.
Having checked the adequacy of the fields after the hash field you can finally get a hash.

Having the hash and having the ex5 file one can search for its origin, the first two variants of the possible origin of the hash have been suggested by me:

Maybe the MD5 is from an ex5 file?
Maybe stored inside ex5 file, search with hex editor...

 
Dear forum members, is there a freelance service for preparing articles for publication? I myself have forgotten all the rules and subtleties of execution. If not, who will undertake to prepare the text of the article "System Indicator" for a fee. Correspondence in private, if not forbidden.
 
Yousufkhodja Sultonov:
Dear forum members, is there a freelance service for preparing articles for publication? I myself have forgotten all the rules and subtleties of execution. If not, who will undertake to prepare the text of the article "System Indicator" for a fee. Correspondence in private, if not forbidden.
Taking any work to private messages is forbidden. For all sorts of odd jobs in freelancing, there is a category called "Training".
 
Vladimir Karputov:
It's forbidden to take any work into private messages. Freelance has a training category for all sorts of odd jobs

Thanks for the reminder, I will use this category.

 
Sergey Dzyublik:

To solve the problem, you first need to understand the problem, i.e. find out what kind of hash it is.

There is an EA like this

void OnDeinit( const int )
{
  int Array[] = {123};
  
  FileSave((string)MQLInfoInteger(MQL_PROGRAM_HASH), Array);
}


When I do a pass, it writes a file with the same name. This is correct.


Then I recompile it and write number 456 instead of 123.

After that, each pass will write the corresponding one and the same file but with a different name.


That's the kind of functionality we need to implement somehow. I.e. if EX5 is changed, the file names it creates will also change.


Using __DATETIME__ macro is not suitable.

 
fxsaber:

This is the kind of functionality that needs to be implemented somehow. I.e. if EX5 is changed, the file names it creates will also change.

What if you put the .ex5 library in a plugin and recompile it?

 
Igor Makanu:

What if you put the .ex5 library in a plug-in library and recompile it?

What difference would that make?