+1 888 340 6572

GMWA

Article/Author: Stocks&Commodities RICO FONT

Download: FUNCTION-GMWA.ELA

File Includes: Function - GMWA

Category: Function > GMWA

Description:

EasyLanguage Code:
INPUTS:  PRICE(NUMERICSERIES),LENGTH(NUMERICSIMPLE),ALPHA(NUMERICSIMPLE);

VARS: SUM(0),COUNTER(0),CSUM(0),W(0),WAVG(0),FACT(0);

FACT = 0;

FOR COUNTER = 0 TO LENGTH - 1
BEGIN {2}
FACT = FACT + POWER(COUNTER + 1,ALPHA);
END; {2}

PRINT (FACT,POWER(COUNTER + 1, ALPHA));

SUM = 0;
CSUM = 0;
FOR COUNTER = 0 TO LENGTH - 1
BEGIN
W = POWER(LENGTH - COUNTER,ALPHA) / FACT;
SUM = SUM + (PRICE[COUNTER] * W);
END;

WAVG = SUM;

GMWA = WAVG;