IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> R-squared Indicator
mrippy
post May 22 2006, 05:52 AM
Post #1
Member


Group: Members
Posts: 24
Joined: 25-December 05
Member No.: 5,080



I am looking for the R-Squared indicator. I first came accross it reading The New Technical Trader, by Chande/Kroll. I then saw it mentioned in Prings, [i]Momentum Explained.
IT is used to determine the strength of a trend. I plan to use it with an oscillator to gauge potential reversals and range/trending etc..
I plan to incorporate this indicator into my trading routine. So this is not some spur of the moment indicator request. I have searched this forum, and another forum, and could not find it. I am unsure if it goes by a different name. I would also be interested in any indicator that does the same thing technicaly.
I could not find a basic easylanguage formula, but found something in Metastock and Amibroker. I hope between these two sources is enough to code this indicator.

Here is Metastock formula:
Pwr(Corr(Com(1),C,14,0),2)

This is a paste of Amibroker info:
Description:
R-2 attempts to measure a percentage of a stocks movement that can be attributed to Linear Regression. When used in combination with Slope you have a tool that can aid in trend detection.

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 0.77
10 0.40
14 0.27
20 0.20
25 0.16
30 0.13
50 0.08
60 0.06
120 0.03

The indicator includes commentary and an interpretation of its use.


Formula:
/*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 ofPeriods r-squaredCritical Value(95%confidence)
5 0.77
10 0.40
14 0.27
20 0.20
25 0.16
30 0.13
50 0.08
60 0.06
120 0.03
*/

R2PDS=20; /*for automatic adjustments to the r2 critical value line use one of
the periods listed above*/

R2=Correlation(Cum( 1 ),C,r2pds)*Correlation(Cum( 1 ),C,r2pds);
slope=LinRegSlope(C,r2pds);

Crit=IIf(R2PDS==5,.77,IIf(R2PDS==10,.40,IIf(R2PDS==14,.27,IIf(R2PDS==20,.20,IIf(R2PDS==25,.16,IIf(R2PDS==30,.13,IIf(R2PDS==50,.08,IIf(R2PDS==60,.06,IIf(R2PDS==120,.03,0)))))))));

Plot(r2,"R Squared",2,1);
Plot(slope,"Slope",IIf(slope<0,4,5),2|styleOwnScale);
Plot(Crit,"",7,1);

Title=WriteIf(R2>Crit,"R2 Values indicate a Trend is in place","R2 Values
Indicate a Trendliess Market")+WriteIf(slope>0,"\n Slope is Positive","\n Slope
is Negative");

"\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)"+

"\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"

+"\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";

Thanks in advance for any help! Mrippy
User is offlineProfile Card
Go to the top of the page
+Quote Post
cskidmore
post May 22 2006, 10:28 AM
Post #2
VT Systems Senior Business Analyst


Group: Root Admin
Posts: 20,613
Joined: 16-June 04
Member No.: 4



Hello,

VT Trader does not currently include the "Correlation" function which is used in both formulas above.

Regards,
Chris
User is offlineProfile Card
Go to the top of the page
+Quote Post
charles
post Jan 19 2008, 08:00 PM
Post #3
Member


Group: Members
Posts: 31
Joined: 10-October 06
Member No.: 8,793



where is the r-squared and linear regression slope stocks and commodities equations?
User is offlineProfile Card
Go to the top of the page
+Quote Post
cskidmore
post Jan 19 2008, 10:21 PM
Post #4
VT Systems Senior Business Analyst


Group: Root Admin
Posts: 20,613
Joined: 16-June 04
Member No.: 4



Hello,

The Linear Regression Slope is a standard indicator in VT Trader. I'll upload the R-Squared indicator for you here. Thank you for reminding me that I need to create a new topic for that one in the S&C Indicators forum.

Regards,
Chris


Attached File(s)
Attached File  vt_R2.vtscr ( 1.08k ) Number of downloads: 306
User is offlineProfile Card
Go to the top of the page
+Quote Post
johngoat
post Feb 15 2009, 06:10 PM
Post #5
Member


Group: Members
Posts: 1
Joined: 15-February 09
Member No.: 33,742



how do i install the r squared indicator now that i've downloaded it?
thanks in advance, johngoat
User is offlineProfile Card
Go to the top of the page
+Quote Post
cskidmore
post Feb 15 2009, 06:47 PM
Post #6
VT Systems Senior Business Analyst


Group: Root Admin
Posts: 20,613
Joined: 16-June 04
Member No.: 4



Hello,

Open the Indicator Builder tool in VT Trader and select the [Import] button. Then, choose the r-squared .vtscr file you saved to your PC previously. The R-Squared indicator should appear in your list of indicators. You can then attach it to your charts like any other indicator.

Regards,
Chris
User is offlineProfile Card
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

 



Lo-Fi Version Time is now: 17th September 2014 - 06:30 AM