Upper-Lower Projection Band

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
Laurent
Posts: 159
Joined: 20 Nov 2010
Location: France
Has thanked: 76 times
Been thanked: 34 times

Upper-Lower Projection Band

Postby Laurent » 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.

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");

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Upper-Lower Projection Band

Postby TJ » 12 Feb 2011

sharp eyes.
thanks for the debugging.


Return to “User Contributed Studies and Indicator Library”