Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 15:40:25 +0000



Linear Regression between subgraphs

View Count: 1865

[2014-06-07 11:13:55]
Leo33 - Posts: 73
Just checking. Is there a study to perform a linear regression between subgraphs?

or should I do it with a spreadsheet [or code one]?

thanks,
[2014-06-07 21:26:59]
Sierra Chart Engineering - Posts: 104368
How would the calculation be done?
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2014-06-08 10:08:18]
Leo33 - Posts: 73
I want a number that quantifies for me how much subgraph A changes for a change in subgraph B, over N bars [N bars is time or volume]
or:
For a change in subgraph A over N bars, what is the change in subgraph B over N bars
so:
What's the linear relationship between X and Y

N is an input
A1 to AN the values of subgraph A over N bars
B1 to BN the values of subgraph B over N bars

I want as the output of the study the gradient M [+1 to -1] of a best fit straight line graph [A1 to AN] against [B1 to BN]

Calculate the equation of the straight line y = -mx + C
using least squares approach [?]
[below from http://hotmath.com/hotmath_help/topics/line-of-best-fit.html]

Step 1: Calculate the mean of the x-values and the mean of the y-values.
Step 2: Compute the sum of the squares of the x-values.
Step 3: Compute the sum of each x-value multiplied by its corresponding y-value.
Step 4: Calculate the slope of the line ...
[I can't copy/paste in the formulae from http://hotmath.com/hotmath_help/topics/line-of-best-fit.html]

That slope is M it's my output +1 to -1


Date Time Of Last Edit: 2014-06-08 10:08:32
[2014-06-11 15:53:28]
vegasfoster - Posts: 444
Just add the Study Subgraph Difference study to your chart and select the two lines as input then add a Moving Linear Regression Study and set Based On to the Study Subgraph Difference study.
[2014-06-11 17:51:28]
Sierra Chart Engineering - Posts: 104368
Try the suggestion given in the prior post.

Otherwise, for something like this, you really need to custom program it using ACSIL:
http://www.sierrachart.com/index.php?l=doc/doc_CreatingDLLs.html
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2014-06-11 18:51:22]
Leo33 - Posts: 73
Thanks vegasfoster. I've done just that. Tried it with the Subgraphs Ratio Study first which I thought would be it... but wasn't, not sure why?

But yes what you suggest is helpful .

Oh for the record I said M was +1 to -1 ..it's not is it....it can be any number.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account