hi,
i ve this script:
[LegacyColorValue = TRUE];
{ ======================================= HEADER ====================================
Poly Inner Channel.
This indicator plots a regression line and two standard deviation bands around it.
====================================== DECLARATIONS ==================================}
inputs:
Len (150),
RedLineLen(150),
Order (3),
SDev(.5),{why not make these inputs}
Price ©; {this cannot be a var, for some reason}
vars:
CURSOR (FALSE),
LASTBAR (TRUE),
sigma (0),
f (0),
Y(0),
b0 (0),
b1 (0),
b2 (0),
b3 (0),
b4 (0);
VARS:
JLAOK(TRUE),
JLAPASS1(0),
JLAPASS2(0),
JLAPASS3(0),
JLAPASS4(0),
JLAPASS5(0),
JLAPASS6(0);
{=========================================MAIN PROGRAM ===================================}
VALUE98=POLY_COEFFS(price,len,order,CURSOR,LASTBAR,b0,b1,b2,b3,b4);
value97=LinearRegValue( Price, RedLineLen, 0 );
if (lastbaronchart and lastbar) or (atcommentarybar and cursor) then
begin
sigma= stddev(price,len);
y=(len-1);
f=0;
while y>(-2)
begin
value5=( b0
+(b1 *f )
+(b2*(power(f, 2)))
+(b3*(power(f, 3)))
+(b4*(power(f, 4)))
);
plot1[y] (value5,"regression");
plot2[y] (value5 + (sdev * sigma ),"Channel+1");
plot3[y] (value5 - (sdev * sigma ),"LChannel -1");
plot4[y] (value97[y], "LR Momentum" );
y=y-1;
f=f+1;
end;
end;
{
commentarycl("b0 = ", b0);
commentarycl("b1 = ", b1);
commentarycl("b2 = ", b2);
commentarycl("b3 = ", b3);
commentarycl("b4 = ", b4);
}
.... but plotting it in multicharts i recive this popup:
Messagge:Error in study "SIGMA INNER CHANNEL
trying to access future data. Bar reference value:-1.
CAN PLEASE ANYBODY HELP ME TO CORRECT THE SCRIPT?
thank you very much