+1 888 340 6572

DayOWkAvg

Article/Author: Omega Research Inc., 1996

Download: FUNCTION-DAYOWKAVG.ELA

File Includes: Function - DayOWkAvg

EasyLanguage Code:
INPUTS: PRICE(NUMERIC), DAYOWEEK(NUMERIC), AVGLEN(NUMERIC);

VARS: WEEKAVG(0);
ARRAY: DOWA[200](0);

WEEKAVG = 0;
IF DAYOFWEEK(DATE) = DAYOWEEK THEN BEGIN
FOR VALUE1 = AVGLEN DOWNTO 2 BEGIN
DOWA[VALUE1] = DOWA[VALUE1 - 1];
END;
DOWA[1] = PRICE;
END;

IF DOWA[AVGLEN] <> 0 THEN BEGIN
FOR VALUE2 = 1 TO AVGLEN BEGIN
WEEKAVG = WEEKAVG + DOWA[VALUE2];
END;
DAYOWKAVG = WEEKAVG / AVGLEN;
END;