Linear Regression token

Login or Register

Please login or register in order to view and post in the Forum.

10 posts / 0 new
Last post
robmak
Last seen: 4 years 10 months ago
Joined: 07/30/2014 - 16:18
Linear Regression token

Hello, I'm looking at this indicator https://www.linnsoft.com/techind/linear-regression . I would like to access some info about the indicator with RTL. Ex: positive slope or negative slope. Or even in which std deviation price is in. In the link , it said to look at LRF token, but that is not the same.

Any help would be appreciated
Thanks.

0
cpayne
Last seen: 1 year 7 months ago
Joined: 03/30/2009 - 00:00
Linear Regression Analysis

Let's start with this chart: https://www.linnsoft.com/charts/linearregressionanalysis-es

In the upper pane, the Linear Regression Forecast (LRF) shows the moving endpoints of a 20 period regression line.  Very similar to a moving average and there are actually moving average types in IRT that give you just this.  The red and green lines are 2 standard deviation bands.  In the 2nd pane, this is the LRS indicator showing the slope of those same 20 period regression lines ending on each bar.  So the value on each bar tells you the slope of...a 20 period regression line drawn through that bar and previous 19.  In the lower pane we again use LRF but this time check the Oscilator checkbox which results in the distance of the closing price of each bar to the linear regression line (gray line in pane 1) and that distance is measure in standard deviation multiples.  You can use the button at the top of chart to adjust the linear regression period used in all 3 panes.

robmak
Last seen: 4 years 10 months ago
Joined: 07/30/2014 - 16:18
I've attached two images of

I've attached two images of linear regression added to your chart, with settings i would like to use.
from 2/27 9:30 to 11:55 it shows a down slope and beyond the 1 std dev line at the top. Then from 2/27 9:30 to 12:55 it shows an up slope and near the 1st dev at the top as well. Seems to be a bit different from LRS/LRF.

robmak
Last seen: 4 years 10 months ago
Joined: 07/30/2014 - 16:18
.

.

cpayne
Last seen: 1 year 7 months ago
Joined: 03/30/2009 - 00:00
LRF and LRS

LRF and LRS operate of a specifc regression period, in this case it's set to 20.  I think your actual regression line is more like 29 or 30.   There is no real concept of doing RTL analysis of a single regression line from a chart.  So you have to decide on a period that works well for you.  Try using button at top to change from 20 to 30.  Then the LRF (blue histogram) will tell you clearly when you're 1 or more standard deviations above the LR line.

robmak
Last seen: 4 years 10 months ago
Joined: 07/30/2014 - 16:18
Ok , now i understand that

Ok , now i understand that LRF and LRS needed specific periods. With linear regression, i always used current day from 9:30 to present.
So i guess the period adjust dynamically thru out the day. 1.2.3.4.5. etc....
So with RTL signal, can LRS made to use a period dynamically thru out the day?

cpayne
Last seen: 1 year 7 months ago
Joined: 03/30/2009 - 00:00
Dynamic Period thru POS & C#

What you might try is adding a custom indicator to the chart with syntax POS.....with POS setup as "Bars from start of session" and let the Custom Indicator store the result into C#1 as seen below.  The Linear Regression indicators will then pick that up and work off that number.  You could even set your linear regression up to work on Last C#1 Bars.  You might want to add the Custom Indicator to the top of the chart (in pane above bars) so that C# gets set before it goes thru the calculation of each linear regression indicator each time...

robmak
Last seen: 4 years 10 months ago
Joined: 07/30/2014 - 16:18
So i attempted to put

So i attempted to put together what you suggestion. Hope i did it right (In general programming is not my strongest suit) . I've attached screenshot of my configurations and also the chart.

I'm not sure if I'm interpreting the LRS correctly. Positive # above 0 is considered slope up correct?
In the chart i attached, in the 2nd pane with LR indicator it shows a positive slope
3rd pane,LRS bars 1-2 are negative, and 3-4 are positive.
5th pane,LRS 1-2 positive and 3-4 negative.

Thank you.

cpayne
Last seen: 1 year 7 months ago
Joined: 03/30/2009 - 00:00
Dynamic Period in Linear Regression

By implementing things the way we have, that dynamic period for the linear regression indicators, which will change from 1 to 2 to 3.... to 20...as the day progresses, will give you the value you want on the current (right-most) bar....which is the most important one, but it does not give you accurate readings for the past historical.   Let's saw we are on the 20th bar of the session, then the dynamic period is going to be set to 20, and that will be the period used for all calculations throughout the chart.  I do understand what you're trying to do, and will see if I can augment LRF and LRS to incorporate a "from start of session" dynamic period that will give you what you want.

robmak
Last seen: 4 years 10 months ago
Joined: 07/30/2014 - 16:18
I would like to incorporate

I would like to incorporate the linear regression in a signal. So would like to know if its positive slope or negative slope. Would be something like, if the slope is positive and some stochastic crossed then put an up arrow on the chart.

I guess what you have suggested previously to do would work moving forward in the future with the most current bar for the calculation.
But just like you mentioned "it does not give you accurate readings for the past historical" . I was trying to see what this signal would have produced in the passed, but it doesnt look right. Currently i can only do it visually with the linear regression indicator and moving to the price i want to determine if its positive or negative.

recorded a short vid of me manually/visually looking at past history https://streamable.com/kbppg
9:30 - 950 -- Positive
9:55 - 12:10 -- Negative
12:15 - till end of day -- Positive.

Then from that, i combine with other indicators.
Hopefully i explained it ok.

Thank you