0 registered members (),
677
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: SSA implementation
[Re: SFF]
#417274
02/11/13 09:17
02/11/13 09:17
|
Joined: Jul 2000
Posts: 27,986 Frankfurt
jcl
Chief Engineer
|
Chief Engineer
Joined: Jul 2000
Posts: 27,986
Frankfurt
|
|
|
|
Re: SSA implementation
[Re: jcl]
#418103
02/21/13 09:53
02/21/13 09:53
|
Joined: Nov 2012
Posts: 209
SFF
OP
Member
|
OP
Member
Joined: Nov 2012
Posts: 209
|
Another SSA version converted. Please check if it is identical to the original code. The Zorro 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.
//+--------------------------------------------------------------------------------------+
//| |
//+--------------------------------------------------------------------------------------+
#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.
|
|
|
Re: SSA implementation
[Re: jcl]
#418107
02/21/13 10:08
02/21/13 10:08
|
Joined: Nov 2012
Posts: 209
SFF
OP
Member
|
OP
Member
Joined: Nov 2012
Posts: 209
|
Hi,
It seems same plot that if I have put normalized input data. I notice that my code just plots a MA of priceClose().
By the way, is it possible to use an up/down arrow in plot?
Last edited by SFF; 02/22/13 04:23.
|
|
|
Re: SSA implementation
[Re: xeim]
#476805
04/04/19 12:54
04/04/19 12:54
|
Joined: Feb 2017
Posts: 1,731 Chicago
AndrewAMD
Serious User
|
Serious User
Joined: Feb 2017
Posts: 1,731
Chicago
|
Hi guys,
How do I get a source code of libssa.dll? I want to compile it as 64-bit library. Step 1: find the author of libssa.dll. Step 2: Kindly ask the author to supply source. Step 3: If author refuses, kindly ask the author to recompile in 64-bit. Step 4: If that fails, you are S.O.L. (Unless you know how decompilers work. )
|
|
|
|