+1 888 340 6572

PercentA

Article/Author: "Standard Error Bands" Jon Anderson, Stocks&Commodities Magazine, Traders Tips, 09/1996

Download: FUNCTION-PERCENTA.ELA

File Includes:
Function - PercentA
Function - CalcA
Function - CalcB

Category: Function > PercentA

Description:

Inputs:
Lenght
SDeg

EasyLanguage Code:
INPUTS: LENGTH(NUMERIC), SDEG(NUMERIC);

VARS: LINREGY(0), X(0), STDERR(0), LINREGS(0), SERR(0), PCNTA(0);

LINREGY = LINEARREGVALUE(CLOSE, LENGTH, 0);
X = CURRENTBAR;

IF CURRENTBAR > LENGTH THEN BEGIN
VALUE1 = (SUMMATION(SQUARE(CLOSE), LENGTH)) - ((CALCA(LENGTH) * SUMMATION(CLOSE, LENGTH))) -
((CALCB(LENGTH) * SUMMATION(X * CLOSE, LENGTH)));
VALUE2 = LENGTH - 2;
VALUE3 = (VALUE1 / VALUE2);
IF VALUE3 > 0 THEN
STDERR = SQUAREROOT(VALUE3)
ELSE
STDERR = STDERR[1];
LINREGS = AVERAGE(LINREGY, SDEG);
SERR = 2 * AVERAGE(STDERR, SDEG);
PCNTA = (CLOSE - (LINREGS-SERR)) / ((LINREGS+SERR)-(LINREGS-SERR)) * 100;
PERCENTA = PCNTA;
END;