Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
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
1 registered members (TipmyPip), 17,605 guests, and 5 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
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,022
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

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