ObjectGetValueByShift(..) return value not the one on Line ?

 

Hi all:

I got a problem about the function ObjectGetValueByShift(…). The price value I got from it is the current price, not the one on the regression line I expected. In other words, I always got Close[0] from ObjectGetValueByShift(“ObjName”, 0). I was disturbed by this problem for several days….
Could any one help me ? Thanks in advance.
Here is my simple testing code,


extern int Reg.Period = 200;
extern double Reg.Deviation = 2;

int start()
{
ObjectDelete("RegChannel");
ObjectCreate("RegChannel", OBJ_STDDEVCHANNEL, 0, iTime(Symbol(), 0, Reg.Period), Close[Reg.Period], Time[0], Close[0] );

ObjectSet("RegChannel", OBJPROP_DEVIATION, Reg.Deviation);
ObjectSet("RegChannel", OBJPROP_COLOR, Tan);
ObjectSet("RegChannel", OBJPROP_RAY, true);

Print("value0 ---- ", ObjectGetValueByShift("RegChannel", 0));

return(0);
}//end start