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

XAverage.V

Article/Author: Origin: Gary Fritz`s site. Originally provided by Bob Fulks, 11/02/1996

Download: t3.ela

File Includes:
Function - XAverage.V
Function - T3Average
Function - T3Average.series
Function - T3Average.simple
Indicator - T3
Indicator - T3Average
Indicator - T3.Demo

Category: Function > XAverage.V

Description:

This is a recoding of the XAverage function as a "simple function" rather than as a "series function". For correct results it must be evaluated on every bar, as is normal for Omega simple functions.

Inputs:
Price
Length

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

VARS : FACTOR(0), XLAST(0);

IF LENGTH + 1 <> 0
THEN BEGIN
IF CURRENTBAR <= 1
THEN BEGIN
FACTOR = 2 / (LENGTH + 1);
XAVERAGE.V = PRICE;
XLAST = PRICE;
END
ELSE BEGIN
VALUE1 = FACTOR * PRICE + (1 - FACTOR) * XLAST;
XAVERAGE.V = VALUE1;
XLAST = VALUE1;
END;
END;