PureBytes Links
Trading Reference Links
|
I used some code from Jose's Linear Regression Trend Line
This is a rough code can anyone improve it. Thanks.
I call this "Residual Plots"
I need two and three standard deviation lines on the indicator thanks.
Residual Plots
======================
pds:=Input("Linear Regression Trendline periods",2,2520,252);
multi:=Input("Standard Deviations(+) / Errors(-)",-100,100,2);
EnDay:=Input("end Day",1,31,31);
EnMnth:=Input("end Month",1,12,12);
EnYear:=Input("end Year",1800,2200,2010);
x:=Input("use: Open=1 Hi=2 Lo=3 Close=4 WghtCl=5 Volume=6",1,6,4);
x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,WC(),If(x=6,V,C)))));
{ End date point }
end:=Year()>EnYear
OR (Year()=EnYear AND (Month()>EnMnth
OR Month()=EnMnth AND DayOfMonth()>=EnDay));
end:=end AND Alert(end=0,2);
end:=If(LastValue(Cum(Ref(end,pds)))=0,
LastValue(Cum(1))=Cum(1),end);
lastValLRI:=LastValue(Highest(
If(end,LinearReg(x,pds),0)));
lastValLRS:=LastValue(Highest(
If(end,LinRegSlope(x,pds),-10000)));
adjust:=LastValue(LastValue(Cum(1))
-Highest(If(end,Cum(1),0)));
countback:=LastValue(Cum(1))-Cum(1)-adjust;
{ Rem next line to extend plot to end of chart }
countback:=Ref(Ref(countback,-adjust),adjust);
{ Lin Reg Trendline }
LR:=lastValLRI-lastValLRS*countback;
restrict:=adjust-(LastValue(Cum(1))-pds);
LRT:=Ref(Ref(LR,-restrict),restrict);
x:= C - LRT;
x;
0;
--- In equismetastock@xxxxxxxxxxxxxxx, "formulaprimer"
<formulaprimer@xxx> wrote:
>
> I want to remove the trends from price data (flattening out the
slope
> polarity). This eliminates the skewing that trend causes. This will
> show a true picture of the market that shows overbought and
oversold
> conditions, without skewing caused by trend. I need something a
code
> derived from price structure that uses principles by DEMING
regarding
> distribution of normalized data. The detrended analysis graphs must
> include an upper and lower control limit based on location of the
mean
> and standard deviation measurements. Also residuals (i.e. projected
> trend - line versus actual value) are plotted on the detrended
graph.
> The detrended graph must contain upper and lower control limits
that
> alerts to statistical overbought and oversold areas. Upper most
line is
> 3 standard deviations of market deviation. Can anyone help me with
this
> MS code i use 7.2 version.
> Thanks.
> Kev
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/equismetastock/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:equismetastock-digest@xxxxxxxxxxxxxxx
mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|