Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Linear Reg Slope Calculation
Collapse
X
-
Linear Reg Slope Calculation
I am not literate in code so I work out of Excel when back-testing various strategies. I am working with changes in linear regression slope for predictive modeling but can't get the slope of linear regression in Excel to match the values in NT, and therefore can't back-test. Is there a way to download historical data WITH indicator values as well? If not, can someone provide the correct formula for the linear regression slope? Any help would be much appreciated.Tags: None
-
-
The indicator "LinRegSlope" is not showing in fact the slope of the LinReg curve. When the LinReg curve is going strongly Up or Down, the absolute value of the slope should be a relatively big number, and in any case greater than during the periods when the LinReg curve is closer to a nearly horizontal line. That is obviously not happening in the embedded indicator "LinRegSlope", as we can see plotting the indicator on a chart.
Terminology can be misleading here:
The slope of the LinReg curve is something different from the Slope of the straight line representing the linear regression of the data i.e. close().
The first is what I am talking about. The latter is what is shown by the indicator "LinRegSlope".
For this reason I would propose using the value :
LinReg(i)[0]-LinReg(i)[1] (where i represents the period parameter of the indicator LinReg)
as a more reliable approximation for the real current slope of the LinReg curve, in case someone needs to use this slope in a Strategy.
Be careful of the signs (+/-) though. The above formula can give positive and negative values.Last edited by KonstantinosNT; 01-11-2023, 07:20 AM.
- Likes 1
Comment
-
Thanks all, I’ll give these a look next week. Good to know that it’s not actually the slope of the linear regression line at a given point in time, that is probably what caused some frustration.
Comment
-
Regarding the formulas of Lin Reg, as it is stated in the NT Help :
" You can view this indicator method source code by selecting the menu New > NinjaScript Editor > Indicators within the NinjaTrader Control Center window. "Last edited by KonstantinosNT; 02-08-2023, 01:42 AM.
Comment
-
Originally posted by KonstantinosNT View PostRegarding the formulas of Lin Reg, as it is stated in the NT Help :
" You can view this indicator method source code by selecting the menu New > NinjaScript Editor > Indicators within the NinjaTrader Control Center window. "
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ageeholdings, Today, 07:43 AM
|
0 responses
7 views
0 likes
|
Last Post
by ageeholdings
Today, 07:43 AM
|
||
Started by pibrew, Today, 06:37 AM
|
0 responses
4 views
0 likes
|
Last Post
by pibrew
Today, 06:37 AM
|
||
Started by rbeckmann05, Yesterday, 06:48 PM
|
1 response
14 views
0 likes
|
Last Post
by bltdavid
Today, 05:43 AM
|
||
Started by llanqui, Today, 03:53 AM
|
0 responses
6 views
0 likes
|
Last Post
by llanqui
Today, 03:53 AM
|
||
Started by burtoninlondon, Today, 12:38 AM
|
0 responses
12 views
0 likes
|
Last Post Today, 12:38 AM |
Comment