Geometry/Math of this 6 lines of code!!

 

to the greatest coders of the forum!!

Can you please explain the geometry/ math behind this code (Roy Kelly Cycle Identifier . I know it repaints!) ..Please 

Using Pi value, and this magical 1.414 or diagram to show it as abcd...

Please

double ZeroLag(double price, int length, int pos)
{  
   if (length < 3)
   {
      return(price);
   }
   double aa = MathExp(-1.414*3.14159 / length);
   double bb = 2*aa*MathCos(1.414*180 / length);
   double CB = bb;
   double CC = -aa*aa;
   double CA = 1 - CB - CC;
   double CD = CA*price + CB*ZL1[pos+1] + CC*ZL1[pos+2];
   return(CD);
}

 
I know this indicator was discussed before especially the repainting part but I am not asking for that in here..your help is greatly appreciated
 
Mrmoore007:
I know this indicator was discussed before especially the repainting part but I am not asking for that in here..your help is greatly appreciated

Not entirely sure about that math, but I can tell you that 1.414 is not magical. It's simply sqrt(2).

I seem to recall that sin(45°) = cos(45°) = 1/sqrt(2).

Maybe that plays into the logic.

 
Anthony Garot:

Not entirely sure about that math, but I can tell you that 1.414 is not magical. It's simply sqrt(2).

I seem to recall that sin(45°) = cos(45°) = 1/sqrt(2).

Maybe that plays into the logic.

Anthony Garot,

yes Cos 45=1/1.414.

But I am not sure what is the logic in applying that so the indicator plots Top or bottom of a cycle?

If I understand the concept correctly I will be able to draw it as ABCD and the angle involved. and which angle is involved? But I can not still draw that diagram because I do not understand the concept

Reason: