Gamestudio Links
Zorro Links
Newest Posts
webGL
by Ice2642. 11/17/25 21:27
Camera always moves upwards?
by NeoDumont. 11/17/25 09:56
Future of ZorroHFT
by TipmyPip. 11/16/25 13:52
COT Download with Quandl does not work
by Petra. 11/15/25 09:35
Training with the R bridge does not work
by Petra. 11/15/25 09:31
Zorro 2.70
by jcl. 11/15/25 08:43
brokerCommand PLOT_HLINE parameters
by M_D. 11/13/25 10:42
ZorroGPT
by TipmyPip. 11/10/25 11:04
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ice2642, TipmyPip), 7,407 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
tritom, sheliepaley, Blueguy, blobplayintennis, someone2
19178 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: 28,030
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,030
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 | 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