Black Friday great discounts start today Learn more
+1 888 340 6572

Averages > WklyAvForDailyData

Article/Author: Omega Research Inc., 1996

Download: WKLYAVFORDAILYDATA.ELA

File Includes: Indicator - WklyAvForDailyData

Category: Indicator > Averages

Description:

This indicator calculates a Weekly average on daily data. This may be useful when aanalysing long-term price changes.

Usage:

The most popular method of interpreting a moving average is to compare the relationship between a moving average of the security's price with the security's price itself (or between several moving averages).




Inputs:

Length - the parameter tells how many bars to average

EasyLanguage Code:
INPUT:LENGTH(5);

ARRAY:HARRAY[200](0),LARRAY[200](0);

IF DAYOFWEEK(DATE) < DAYOFWEEK(DATE[1]) THEN BEGIN
VALUE4 = 0; VALUE5 = 0;
HARRAY[LENGTH + 1] = VALUE1;
LARRAY[LENGTH + 1] = VALUE2;

FOR VALUE0 = 1 TO LENGTH BEGIN
HARRAY[VALUE0] = HARRAY[VALUE0 + 1];
LARRAY[VALUE0] = LARRAY[VALUE0 + 1];
VALUE4 = VALUE4 + HARRAY[VALUE0];
VALUE5 = VALUE5 + LARRAY[VALUE0];
END;
VALUE1 = H;
VALUE2 = L;
VALUE3 = 0;
VALUE6 = ROUND(VALUE4 / LENGTH,2);
VALUE7 = ROUND(VALUE5 / LENGTH,2);
PLOT1[1](VALUE6,"H");
PLOT2[1](VALUE7,"L");
END;

IF H > VALUE1 THEN VALUE1 = H;
IF L < VALUE2 THEN VALUE2 = L;