Annualized Exponential Linear Regression Slop of X Bars

Questions about MultiCharts and user contributed studies.
Kamisyed
Posts: 8
Joined: 25 Feb 2014
Has thanked: 1 time
Been thanked: 3 times

Annualized Exponential Linear Regression Slop of X Bars

Postby Kamisyed » 28 Jul 2017

Hi, I would highly appreciate if someone on the forum could please assist with this indicator below. I am trying to plot the annualized exponential linear regression slope multiplied by the coefficient of determination (i.e. RSquared).

I essentially need to calculate the exponential linear regression slope (based on lognormal prices), then annualize it based on 250 trading days in a year, and then multiply it by RSquared. I have drafted the following code, but not sure if correct.

Any help would be seriously & highly appreciated!!!!

Code: Select all

// Annualized Exponential Linear Regression Slope
Inputs:
Price (Close),
Length1 (250);

Vars:
LRS1 (0), AnnExpLRS1 (0), T1(0);
LRS1 = LinearRegSlope(Log(Price), Length1);
AnnExpLRS1 = (power((1+LRS1),250) - 1) * 100;
T1= AnnExpLRS1 * RSquare(Barnumber, Price, Length1);

Plot1(T1, "T1");
Plot2( 5, "5Line" ) ;
Plot3( 0, "ZeroLine" ) ;
Last edited by Kamisyed on 28 Jul 2017, edited 2 times in total.

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Annualized Exponential Linear Regression Slop of X Bars

Postby TJ » 28 Jul 2017

See post #1 & #2
viewtopic.php?t=11713

Kamisyed
Posts: 8
Joined: 25 Feb 2014
Has thanked: 1 time
Been thanked: 3 times

Re: Annualized Exponential Linear Regression Slop of X Bars

Postby Kamisyed » 28 Jul 2017

Thanks for the heads up TJ. Updated the post with Code properly tagged.


Return to “MultiCharts”