Indicators: FullSSA

 

FullSSA:

The redrawing oscillator drawn on the basis of the SSA.mqh singular transformation library of functions

Fig.1 The FullSSA indicator

Fig.1 The FullSSA indicator

Author: Nikolay Kositsin

 
for(k=0;k<=n-2;k++)for(i=k+1;i<=n-1;i++)
     {
      if(!B[k][k])
        {
         for(i1=0;i<=n-1;i++)
           {
            w[i1]=B[i1][k];
            B[i1][k]=B[i1][k+1];
            B[i1][k+1]=w[i1];
           }
         cp++;
        }
      Print(__FUNCTION__+": i=",i);  
      c=1.0*B[i][k]/B[k][k];
      for(j=0;j<=n-1;j++) B[i][j]-=B[k][j]*c;
     }

2019.03.31 00:07:28.689 (GBPUSD,H1) array out of range in 'SSA.mqh' (147,14)


 
        for(i1=0;i1<=n-1;i1++)
           {
            w[i1]=B[i1][k];
            B[i1][k]=B[i1][k+1];
            B[i1][k+1]=w[i1];
           }

must be i1 everywhere in for() ?

 
leonerd:

must be i1 everywhere in for() ?

You're the fool.

 
Алексей Тарабанов:

You are a fool yourself.

Russian Ministry of Health hotline:8 800 550 99 03

 

There's one error after another. Array overruns and division by 0.

And I don't know how to correct it, as I don't understand what this library is about at all....

This loop, for example:

for(k=0;k<=n-2;k++)for(i=k+1;i<=n-1;i++)
     {
      if(!B[k][k])
        {
         for(i1=0;i<=n-1;i++)
           {
            w[i1]=B[i1][k];
            B[i1][k]=B[i1][k+1];
            B[i1][k+1]=w[i1];
           }
         cp++;
        }
        
      c=1.0*B[i][k]/B[k][k];
      for(j=0;j<=n-1;j++) B[i][j]-=B[k][j]*c;
     }
If it reaches the inner loop for (and it does, because B[k][k] is equal to zero), then i already exceeds the outer loop limit, i.e. i becomes greater than n-1. And then, when accessing B[i], we get an exit beyond the array's limits, because by an amazing coincidence its size is equal to n.