Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: Gaussian MACD [Re: jcl] #417611
02/14/13 13:29
02/14/13 13:29
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
There is no explanation about how to pass series to function in workshop 4.
Please explain.

Re: Gaussian MACD [Re: jcl] #417614
02/14/13 13:59
02/14/13 13:59
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
I have made the working code without using function.
If you can make function used version it will be helpful.

Code:
var GSMOOTH(var price_,vars arr,var alfa){
	 var ret = pow(alfa,4)*price_ + 4*(1-alfa)*arr[0+1] - 6*pow(1-alfa,2)*arr[0+2] + 4*pow(1-alfa,3)*arr[0+3] - pow(1-alfa,4)*arr[0+4];
    return (ret);
}
  
var getAlfa(var p){
       var pis = 3.1415926535;
       var w = 2*pis/p;
	    var beta = (1 - cos(w))/(pow(1.414,2.0/3) - 1);
	    var alfa = -beta + sqrt(beta*beta + 2*beta);
	    return (alfa);
}

function run(){
	
  set(TICKS);
	
  int Fast=26;
  int Slow=12;
  int Signal=3;
  
  vars Fastalfa=series(getAlfa(Fast));
  vars Slowalfa=series(getAlfa(Slow));
  vars Signalalfa=series(getAlfa(Signal));
  vars Close=series(priceClose());
  
  var price_,alfa;
  vars arr = series();
  vars ma = series(pow(Slowalfa[0],4)*Close[0] + 4*(1-Slowalfa[0])*arr[0+1] - 6*pow(1-Slowalfa[0],2)*arr[0+2] + 4*pow(1-Slowalfa[0],3)*arr[0+3] - pow(1-Slowalfa[0],4)*arr[0+4]);
  vars maf = series(pow(Fastalfa[0],4)*Close[0] + 4*(1-Fastalfa[0])*arr[0+1] - 6*pow(1-Fastalfa[0],2)*arr[0+2] + 4*pow(1-Fastalfa[0],3)*arr[0+3] - pow(1-Fastalfa[0],4)*arr[0+4]);
  vars mains=series(ma[0]-maf[0]);  
  
  vars signal = series(pow(Signalalfa[0],4)*mains[0] + 4*(1-Signalalfa[0])*arr[0+1] - 6*pow(1-Signalalfa[0],2)*arr[0+2] + 4*pow(1-Signalalfa[0],3)*arr[0+3] - pow(1-Signalalfa[0],4)*arr[0+4]);
  
  
  vars tmp=series(mains[0]-signal[0]);
  
  
  
      if(tmp[0]>tmp[1]){
         exitShort();
         enterLong();
      }
      if(tmp[0]<tmp[1]){
         exitLong();
         enterShort();
      }

}


Re: Gaussian MACD [Re: SFF] #417616
02/14/13 14:15
02/14/13 14:15
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Please look in workshop 4. A series is passed to a function by writing the name of the series inside the parentheses.

Do not continue here until you have read at least workshops 4 and 5. You can not write own scripts without understanding the workshops and knowing how to use variables, functions, and series. If you do not understand something from the workshops, just ask and I'll help. But as long as basic understanding is missing, continuing with your script makes no sense and will only lead to frustration.

Re: Gaussian MACD [Re: jcl] #417617
02/14/13 14:28
02/14/13 14:28
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
I looked in it and finally I know what you mean.

The correct code is updated in post 1.

Sorry for confusion but if you would answer the correct script it would not take so long.

Last edited by SFF; 02/14/13 14:32.
Page 3 of 3 1 2 3

Moderated by  Petra 

Gamestudio download | 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