Another SSA version converted.
Please check if it is identical to the original code.

The Zorro code.
Code:
#define SSALag			25
#define SSANumberOfComputations	2
#define SSANumberOfBars 	300

var __stdcall fastSingular(double* sourceArray,int arraySize, int lag,int numberOfComputationLoops, double* destinationArray);
API(fastSingular,libSSA)

// helper function to reverse a series
vars reverse(vars Data)
{
	vars Reversed = series();
	int i;
	for(i=0; i<LookBack; i++)
		Reversed[i] = Data[LookBack-i-1];
	return Reversed;
}


function run()
{
	LookBack = SSANumberOfBars;
	BarPeriod = 15;
LookBack = 500;
StartDate = 20121031;
NumDays = 1;
	

	vars close = series(priceClose());

	
	var out[SSANumberOfBars];
	fastSingular(reverse(close),SSANumberOfBars,SSANumberOfComputations,SSALag,out);
	
	plot("Normalized",close[0],0,RED);
	set(PLOTPRICE+PLOTNOW);
}



The original code.
Code:
//+--------------------------------------------------------------------------------------+
//|                                                                                      |
//+--------------------------------------------------------------------------------------+
#property copyright "www.forex-tsd.com"
#property link      "www.forex-tsd.com"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 PaleVioletRed
#property indicator_width1 2

#import "libSSA.dll"
   void fastSingular(double& sourceArray[],int arraySize, int lag, int numberOfComputationLoops, double& destinationArray[]);
#import

//
//
//
//
//

extern int SSAPrice                =  PRICE_CLOSE;
extern int SSALag                  =  25;
extern int SSANumberOfComputations =   2;
extern int SSANumberOfBars         = 300;
extern int FirstBar                = 300; 

//
//
//
//
//

double in[];
double pr[];
double ssaIn[];
double ssaOut[];

//+--------------------------------------------------------------------------------------+
//|                                                                                      |
//+--------------------------------------------------------------------------------------+
//
//
//
//
//

int init()
{
   IndicatorBuffers(2);
      SetIndexBuffer(0,in);
      SetIndexBuffer(1,pr);
   IndicatorShortName("SSA end-pointed");
   return(0);
}
int deinit(){return(0);}

//+--------------------------------------------------------------------------------------+
//|                                                                                      |
//+--------------------------------------------------------------------------------------+
//
//
//
//
//

int start()
{
   int i,limit,counted_bars = IndicatorCounted();

   if(counted_bars < 0) return(-1);
   if(counted_bars > 0) counted_bars--;
      limit = MathMin(Bars-counted_bars,Bars-1);

   //
   //
   //
   //
   //

   for(i=limit; i>=0; i--)
   {
      pr[i] = iMA(NULL,0,1,0,MODE_SMA,SSAPrice,i);

      //
      //
      //
      //
      //
      
      if (i<=FirstBar)
      {
         int ssaBars = MathMin(Bars-i,SSANumberOfBars);
         if (ssaBars<SSALag) continue;
               if (ArraySize(ssaIn) != ssaBars)
               {
                  ArrayResize(ssaIn ,ssaBars);
                  ArrayResize(ssaOut,ssaBars);
               }
               ArrayCopy(ssaIn,pr,0,i,ssaBars);
      
         fastSingular(ssaIn,ssaBars,SSALag,SSANumberOfComputations,ssaOut);
         in[i]=ssaOut[0];
      }                   
   }                  
   return(0); 
}


Last edited by SFF; 02/21/13 10:08.