Gamestudio Links
Zorro Links
Newest Posts
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
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, dr_panther), 1,211 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
AGC and smoothF should take a var Period argument instead of int #447652
12/24/14 20:07
12/24/14 20:07
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
Looking at the code for AGC in indicators.c, AGC has a convenient (but undocumented) behavior when Period == 0. The smoothing factor is set to 0.991, which matches several of Ehler's codes.
Code:
var AGC(var *Data, int Period) {
   var a = 0.991;
   if(Period) a = smoothF(Period);
   ...

In other cases, smoothing factor is smoothF(Period), which is an inline function that takes an integer.
Code:
inline var smoothF(int period) { return 2./(period+1); }


My feeling is that AGC and smoothF should not be a step function. I arrived at this opinion after observing that there is no way for smoothF to produce the default value AGC uses, 0.991, except via the magic Period=0. The first few values are
smoothF(0) = 2.
smoothF(1) = 1.
smoothF(2) = 0.66
smoothF(3) = 0.5
Output of 0.991 would correspond to Period =~ 1.018 if Period were allowed to be a continuous variable.

I guess, if that doesn't appeal to you, an alternative is that AGC should take a "smoothing factor" instead of a "Period". This is similar to my earlier suggestion about allowing EMA's alpha factor to be adjustable.

Re: AGC and smoothF should take a var Period argument instead of int [Re: GPEngine] #447699
12/29/14 12:28
12/29/14 12:28
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Good idea. We'll implement overloaded functions for recursive indicators that accept alpha instead of a period.

Re: AGC and smoothF should take a var Period argument instead of int [Re: jcl] #447705
12/29/14 21:12
12/29/14 21:12
Joined: Jan 2013
Posts: 68
I
ibra Offline
Junior Member
ibra  Offline
Junior Member
I

Joined: Jan 2013
Posts: 68
GPEngine, what's your background in programming? If I may ask.

I'm impressed with your contribution to the Zorro project. And tbh, I barely understand a word of what you and JCL are talking about in this thread. Still learning though!


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