PureBytes Links
Trading Reference Links
|
<FONT face=Arial color=#0000ff
size=2>Jeremy,
<FONT face=Arial color=#0000ff
size=2>
I put
this in the library some time ago. Hope it helps or at least gets you
started...
Regards,
Jayson
<FONT
color=#008000>
/*To determine if the trend is
statistically significant for a given x-period linear regression line, Plot the
r-squared indicator and refer to the following table. This table shows the
values of r-squared required for A 95% confidence level at various time periods.
If the r-squared value is less than the critical values shown, you should assume
that prices show no statistically significant trend.
Number of Periods r-squared Critical
Value(95%confidence)
5<SPAN
class=216030717-06022004> 0.77
10 <SPAN
class=216030717-06022004> 0.40
14 <SPAN
class=216030717-06022004> 0.27
20 <SPAN
class=216030717-06022004> 0.20
25 <SPAN
class=216030717-06022004> 0.16
30 <SPAN
class=216030717-06022004> 0.13
50 <SPAN
class=216030717-06022004> 0.08
60 <SPAN
class=216030717-06022004> 0.06
120 <SPAN
class=216030717-06022004> 0.03
*/<FONT color=#282828
size=2>
R2PDS=<FONT
color=#0000ff>14; <FONT
color=#008000 size=2>/*for automatic adjustments
to the r2 critical value line use one of the periods listed
above*/
R2=(<FONT
color=#0000ff>Correlation(<FONT
size=2>Cum( 1
),C<FONT
color=#0000ff>,r2pds))^<FONT
size=2>2<FONT face=Arial
color=#0000ff>;
slope=<FONT
color=#0000ff>LinRegSlope(<FONT
size=2>C<FONT face=Arial
color=#0000ff>,r2pds);
Crit=<FONT
color=#0000ff>IIf(R2PDS==<FONT
size=2>5,.77,IIf<FONT
size=2>(R2PDS==10,.40,<FONT
size=2>IIf(R2PDS==14<FONT
size=2>,.27,IIf(R2PDS==<FONT
size=2>20,.20,IIf<FONT
size=2>(R2PDS==25,.16,<FONT
size=2>IIf(R2PDS==30<FONT
size=2>,.13,IIf(R2PDS==<FONT
size=2>50,.08,IIf<FONT
size=2>(R2PDS==60,.06,<FONT
size=2>IIf(R2PDS==120<FONT
size=2>,.03,0<FONT color=#282828
size=2>)))))))));<FONT
color=#0000ff size=2>
Plot<FONT color=#282828
size=2>(r2,"R Squared"<FONT
color=#282828 size=2>,colorYellow<FONT
face=Arial>,<FONT color=#ff00ff
size=2>1<FONT
face=Arial>);
<FONT face=Arial
color=#0000ff>//Plot(MA(r2,5),"Trigger",colorYellow,1);<FONT
color=#0000ff size=2>
Plot<FONT color=#282828
size=2>(slope,"Slope"<FONT
color=#282828 size=2>,IIf<FONT
color=#282828 size=2>(slope<0<FONT
color=#282828 size=2>,4<FONT
color=#282828 size=2>,5<FONT
color=#282828 size=2>),2<FONT
color=#282828 size=2>|<FONT
size=2>styleOwnScale<FONT
face=Arial>);
Plot<FONT color=#282828
size=2>(Crit,""<FONT color=#282828
size=2>,7<FONT color=#282828
size=2>,1<FONT color=#282828
size=2>);
Title<FONT
color=#0000ff>=WriteIf<FONT
size=2>(R2>Crit,"R2 Values indicate a Trend is in
place","R2 Values Indicate a Trendliess
Market")+WriteVal<FONT
size=2>(r2)+WriteIf<FONT
size=2>(slope>0,<FONT
size=2>"\n Slope is Positive","\n Slope
is Negative"<FONT face=Arial
color=#0000ff>);
"\n \n Interpretation \n r-squared values
show the percentage of movement that can be explained by linear regression. For
example, if the r-squared value over 20 days is at 70%, this means that 70% of
the movement of the security is explained by linear regression. The other 30% is
unexplained Random noise.\n While R2 values are interesting on their own they
are easier to interpret when used in conjunction with Slope. When R2 exceeds its
critical Value this indicates the market is Trending, when the indicator falls
below its threshold then a trend less condition may be in place. \n This table
shows the values of r-squared required for A 95% confidence level at various
time periods. If the r-squared value is less than the critical values shown, you
should assume that prices show no statistically significant trend. \n \n R-2 Pds
Critical Value(95%confidence)"<FONT
face=Arial color=#0000ff>+
"\n \n 5 0.77\n 10 0.40\n 14 0.27\n 20
0.20\n 25 0.16\n 30 0.13\n 50 0.08 \n 60 0.06 \n 120
0.03"
+<FONT face=Arial
color=#0000ff size=2>"\n \n You may even consider opening a Short-term position
opposite the prevailing trend when you observe r-squared rounding off at extreme
levels. For example, if the slope is positive AND r-squared is above 0.80 then
begins to turn down, you may consider selling or opening A Short position. There
are numerous ways to use the linear regression outputs of r-squared and Slope in
trading systems. For more detailed coverage, refer to the book The New Technical
Trader by Tushar Chande and Stanley Kroll"<FONT color=#282828
size=2>;
<FONT face=Tahoma
size=2>-----Original Message-----From: jeremy_berkovits
[mailto:jberkovits1@xxxxxxxxxx]Sent: Friday, February 06, 2004 12:00
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker]
Calculating critical R squared valueDoes anyone know
how to calculate the critical value for an X periodr
squared?Regards,Jeremy berkovits Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|