Upper-Lower Projection Band
Posted: 12 Feb 2011
It seems there are several errors in the formula of the Upper-Lower Projection Bands.
Here the code of the formula with the errors corrected in comments.
Here the code of the formula with the errors corrected in comments.
Code: Select all
INPUTS: LENGTH(14);
VARS: SL(0), SH(0), PL(0), PU(0);
SL=LINEARREGSLOPE(LOW,LENGTH);
SH=LINEARREGSLOPE(HIGH,LENGTH);
FOR VALUE1=1 TO LENGTH BEGIN
VALUE2=LOW[VALUE1-1] + (SL*VALUE1-1); // ERROR it's (SL*(VALUE1-1));
VALUE3=HIGH[VALUE1-1] + (SH*VALUE1-1); // ERROR it's (SL*(VALUE1-1));
[/b]
IF VALUE1=1 THEN BEGIN
PL=VALUE2;
PU=VALUE3;
END;
IF VALUE2 THEN PL=VALUE2; // ERROR it's Value2 < PL
IF VALUE3>PU THEN PU=VALUE3;
END;
PLOT1(PL,"PL");
PLOT2(PU,"PU");