Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/19/24 18:45
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, 7th_zorro, TedMar, Ayumi), 800 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Gaussian MACD #417090
02/08/13 11:26
02/08/13 11:26
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
Hi, I am writing this code but it is wrong and I don't know where and why it is not correct.

The rule is simple. If bar is bule, enter long and red is short.
You can see images and the original code converted from.
http://codebase.mql4.com/8057

Please help me.

Thanks in advance.


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());
  vars ma = series();
  ma = series(GSMOOTH(Close[0],ma,Slowalfa[0]));
  vars maf = series();
  maf=series(GSMOOTH(Close[0],maf,Fastalfa[0]));
  vars mains=series(ma[0]-maf[0]);
  vars signal = series();
  signal=series(GSMOOTH(mains[0],signal,Signalalfa[0]));
  vars tmp=series(mains[0]-signal[0]);
  
  
      if(tmp[0]>tmp[1]){
         exitShort();
         enterLong();
      }
      if(tmp[0]<tmp[1]){
         exitLong();
         enterShort();
      }

}


Last edited by SFF; 02/14/13 14:30.
Re: Gaussian MACD [Re: SFF] #417101
02/08/13 13:08
02/08/13 13:08
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
I think this can not even compile - don't you get an error for the wrong price_ type in GSMOOTH?

Re: Gaussian MACD [Re: jcl] #417145
02/08/13 23:26
02/08/13 23:26
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
Yes, I got it but I don't know what is wrong in the code.

Re: Gaussian MACD [Re: SFF] #417394
02/12/13 09:08
02/12/13 09:08
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
You typed "vars" instead of "var".

Re: Gaussian MACD [Re: jcl] #417403
02/12/13 11:33
02/12/13 11:33
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
Which line you are taking about?

Re: Gaussian MACD [Re: SFF] #417413
02/12/13 12:45
02/12/13 12:45
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
var GSMOOTH(vars price_,vars arr,var alfa)...

must be

var GSMOOTH(var price_,vars arr,var alfa)...

Re: Gaussian MACD [Re: jcl] #417464
02/12/13 23:07
02/12/13 23:07
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
Thanks, but still same error remains.
What should I do?

Re: Gaussian MACD [Re: SFF] #417480
02/13/13 10:45
02/13/13 10:45
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Not acting so helplessly.

The error message normally shows you the very line where you mistyped something or made some other mistake. Just correct it. I showed you how to fix the first mistake. If there are more, you should be able to fix them too.

If you can not solve the problem, then post the content of the error message here and I'll help. But first try yourself. For copying a message, just double click into Zorro's message window.

Also, try to understand the strategy. If you do not know precisely how the strategy works and what it does, you can not successfully code or convert it.

Re: Gaussian MACD [Re: jcl] #417483
02/13/13 10:56
02/13/13 10:56
Joined: Nov 2012
Posts: 209
S
SFF Offline OP
Member
SFF  Offline OP
Member
S

Joined: Nov 2012
Posts: 209
OK.

After correct the mistake that you showed me the same error happened.
The message is
Error in 'line 29:
'GSMOOTH' : Pointer expected
< vars ma = series(GSMOOTH(Close[0],mas[0],Slowalfa[0]);
>

I tried what I know but don't correct it.

Re: Gaussian MACD [Re: SFF] #417485
02/13/13 11:05
02/13/13 11:05
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
This time it's the mas[0] that is wrong.

What does your function expect as second parameter, a var or a series?

Page 1 of 3 1 2 3

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