Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (SBGuy), 652 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: SSA implementation [Re: SFF] #417274
02/11/13 09:17
02/11/13 09:17
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
Define what?

Re: SSA implementation [Re: jcl] #417286
02/11/13 10:28
02/11/13 10:28
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
2 color line of SSA as the original.

Re: SSA implementation [Re: SFF] #417289
02/11/13 10:44
02/11/13 10:44
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
A line can have only one color, so for two colors plot two alternating lines. The color is however irrelevant for trading.

Re: SSA implementation [Re: jcl] #418103
02/21/13 09:53
02/21/13 09:53
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
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.
Re: SSA implementation [Re: SFF] #418105
02/21/13 10:05
02/21/13 10:05
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
The lag is different. But from what I understood, fastSingular needs normalized input data - so how can that code work?

Re: SSA implementation [Re: jcl] #418107
02/21/13 10:08
02/21/13 10:08
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

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: SFF] #418218
02/22/13 09:49
02/22/13 09:49
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
Could you post a complete correct code for it?
I only plot just MA not SSA line.

Re: SSA implementation [Re: SFF] #476793
04/03/19 22:27
04/03/19 22:27
Joined: Apr 2019
Posts: 1
X
xeim Offline
Guest
xeim  Offline
Guest
X

Joined: Apr 2019
Posts: 1
Hi guys,

How do I get a source code of libssa.dll?
I want to compile it as 64-bit library.

Re: SSA implementation [Re: xeim] #476805
04/04/19 12:54
04/04/19 12:54
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Offline
Serious User
AndrewAMD  Offline
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Originally Posted By: xeim
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. cool )

Page 2 of 2 1 2

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1