//+--------------------------------------------------------------------------------------+
//| |
//+--------------------------------------------------------------------------------------+
#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);
}