Calculate boundries within which $r$ remains above a critical value given correlation coefficient $(x,f(x)) =...











up vote
0
down vote

favorite












I'm experimenting with a trading indicator based on the correlation of the closing price of a day and the simple moving average of P periods. When the correlation is above certain threshold, I need to determine at what closing price the correlation of this day will be go below that threshold.



Example:



y, is the simple moving average of 5 periods, starting at t4.
r, is calculated with previous 5 periods.
t0: x0=1, y0=(1)/1
t1: x1=2, y1=(1+2)/2
t2: x2=3, y2=(1+2+3)/3
t3: x3=4, y3=(1+2+3+4)/4
t4: x4=5, y4=(1+2+3+4+5)/5 ,r4=1
t5: x5=7, y5=(2+3+4+5+7)/5 ,r5= 0.9974
t6: x6=6, y6=(3+4+5+7+6)/5 ,r6=0.8826
t7: x7=8, y7=(4+5+7+6+8)/5 ,r7= 0.906
t8: x8=9, y8=(5+7+6+8+9)/5 ,r8= 0.917

Q: t9: x9=?, y9=(7+6+8+9+x9)/5, r9=0.9
How do I get x9 (nearest to x8) for r9=0.9.


I'd like to know if there's a general solution so that f(x) may not necessarily be the simple moving average but another linear function.



Thanks in advance.



Update:



Excel Worksheet



In the previous example, y12 is calculated based on x12 and y11. So, in this case I just need to know x12 to calculate r12. But What I want is the value of x13 at which r13 crosses certain limit which is closer to x12 (I'm thinking that in this example that value should be higher than x12).
For now I'm just using a loop to determine that value calculating r in each loop untill I get an approximated value that crosses the limit but I don't like it.










share|cite|improve this question









New contributor




Pedro S. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I'm not sure I understand your problem. Can you give a small example and update the question?
    – tpb261
    Nov 16 at 6:16










  • Just added an example. Thanks.
    – Pedro S.
    Nov 16 at 11:30










  • I think this example might be not enough to understand the problem. At least for me.
    – Jaroslaw Matlak
    Nov 16 at 12:23










  • @Jaroslaw Matlak , I changed the example, I hope it's clearer.
    – Pedro S.
    Nov 16 at 13:09










  • I don't have a solution for you, but maybe someone else does? So, I'll try to put your question in symbols: Given a series X=$[x_1, x_2, ... x_n, ...]$ and a function $y_k = f(x, k) = f_k(x_{k-i+1}, x_{k-i+2},..., x_{k})$, you want to know if it possible to find the range of $x_{n+1}$ given $x_1$ to $x_n$, such that $y_{n+1} le r$. Am I correct, or did I miss something?
    – tpb261
    yesterday

















up vote
0
down vote

favorite












I'm experimenting with a trading indicator based on the correlation of the closing price of a day and the simple moving average of P periods. When the correlation is above certain threshold, I need to determine at what closing price the correlation of this day will be go below that threshold.



Example:



y, is the simple moving average of 5 periods, starting at t4.
r, is calculated with previous 5 periods.
t0: x0=1, y0=(1)/1
t1: x1=2, y1=(1+2)/2
t2: x2=3, y2=(1+2+3)/3
t3: x3=4, y3=(1+2+3+4)/4
t4: x4=5, y4=(1+2+3+4+5)/5 ,r4=1
t5: x5=7, y5=(2+3+4+5+7)/5 ,r5= 0.9974
t6: x6=6, y6=(3+4+5+7+6)/5 ,r6=0.8826
t7: x7=8, y7=(4+5+7+6+8)/5 ,r7= 0.906
t8: x8=9, y8=(5+7+6+8+9)/5 ,r8= 0.917

Q: t9: x9=?, y9=(7+6+8+9+x9)/5, r9=0.9
How do I get x9 (nearest to x8) for r9=0.9.


I'd like to know if there's a general solution so that f(x) may not necessarily be the simple moving average but another linear function.



Thanks in advance.



Update:



Excel Worksheet



In the previous example, y12 is calculated based on x12 and y11. So, in this case I just need to know x12 to calculate r12. But What I want is the value of x13 at which r13 crosses certain limit which is closer to x12 (I'm thinking that in this example that value should be higher than x12).
For now I'm just using a loop to determine that value calculating r in each loop untill I get an approximated value that crosses the limit but I don't like it.










share|cite|improve this question









New contributor




Pedro S. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I'm not sure I understand your problem. Can you give a small example and update the question?
    – tpb261
    Nov 16 at 6:16










  • Just added an example. Thanks.
    – Pedro S.
    Nov 16 at 11:30










  • I think this example might be not enough to understand the problem. At least for me.
    – Jaroslaw Matlak
    Nov 16 at 12:23










  • @Jaroslaw Matlak , I changed the example, I hope it's clearer.
    – Pedro S.
    Nov 16 at 13:09










  • I don't have a solution for you, but maybe someone else does? So, I'll try to put your question in symbols: Given a series X=$[x_1, x_2, ... x_n, ...]$ and a function $y_k = f(x, k) = f_k(x_{k-i+1}, x_{k-i+2},..., x_{k})$, you want to know if it possible to find the range of $x_{n+1}$ given $x_1$ to $x_n$, such that $y_{n+1} le r$. Am I correct, or did I miss something?
    – tpb261
    yesterday















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm experimenting with a trading indicator based on the correlation of the closing price of a day and the simple moving average of P periods. When the correlation is above certain threshold, I need to determine at what closing price the correlation of this day will be go below that threshold.



Example:



y, is the simple moving average of 5 periods, starting at t4.
r, is calculated with previous 5 periods.
t0: x0=1, y0=(1)/1
t1: x1=2, y1=(1+2)/2
t2: x2=3, y2=(1+2+3)/3
t3: x3=4, y3=(1+2+3+4)/4
t4: x4=5, y4=(1+2+3+4+5)/5 ,r4=1
t5: x5=7, y5=(2+3+4+5+7)/5 ,r5= 0.9974
t6: x6=6, y6=(3+4+5+7+6)/5 ,r6=0.8826
t7: x7=8, y7=(4+5+7+6+8)/5 ,r7= 0.906
t8: x8=9, y8=(5+7+6+8+9)/5 ,r8= 0.917

Q: t9: x9=?, y9=(7+6+8+9+x9)/5, r9=0.9
How do I get x9 (nearest to x8) for r9=0.9.


I'd like to know if there's a general solution so that f(x) may not necessarily be the simple moving average but another linear function.



Thanks in advance.



Update:



Excel Worksheet



In the previous example, y12 is calculated based on x12 and y11. So, in this case I just need to know x12 to calculate r12. But What I want is the value of x13 at which r13 crosses certain limit which is closer to x12 (I'm thinking that in this example that value should be higher than x12).
For now I'm just using a loop to determine that value calculating r in each loop untill I get an approximated value that crosses the limit but I don't like it.










share|cite|improve this question









New contributor




Pedro S. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I'm experimenting with a trading indicator based on the correlation of the closing price of a day and the simple moving average of P periods. When the correlation is above certain threshold, I need to determine at what closing price the correlation of this day will be go below that threshold.



Example:



y, is the simple moving average of 5 periods, starting at t4.
r, is calculated with previous 5 periods.
t0: x0=1, y0=(1)/1
t1: x1=2, y1=(1+2)/2
t2: x2=3, y2=(1+2+3)/3
t3: x3=4, y3=(1+2+3+4)/4
t4: x4=5, y4=(1+2+3+4+5)/5 ,r4=1
t5: x5=7, y5=(2+3+4+5+7)/5 ,r5= 0.9974
t6: x6=6, y6=(3+4+5+7+6)/5 ,r6=0.8826
t7: x7=8, y7=(4+5+7+6+8)/5 ,r7= 0.906
t8: x8=9, y8=(5+7+6+8+9)/5 ,r8= 0.917

Q: t9: x9=?, y9=(7+6+8+9+x9)/5, r9=0.9
How do I get x9 (nearest to x8) for r9=0.9.


I'd like to know if there's a general solution so that f(x) may not necessarily be the simple moving average but another linear function.



Thanks in advance.



Update:



Excel Worksheet



In the previous example, y12 is calculated based on x12 and y11. So, in this case I just need to know x12 to calculate r12. But What I want is the value of x13 at which r13 crosses certain limit which is closer to x12 (I'm thinking that in this example that value should be higher than x12).
For now I'm just using a loop to determine that value calculating r in each loop untill I get an approximated value that crosses the limit but I don't like it.







correlation






share|cite|improve this question









New contributor




Pedro S. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|cite|improve this question









New contributor




Pedro S. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|cite|improve this question




share|cite|improve this question








edited yesterday





















New contributor




Pedro S. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 16 at 5:54









Pedro S.

11




11




New contributor




Pedro S. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Pedro S. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Pedro S. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • I'm not sure I understand your problem. Can you give a small example and update the question?
    – tpb261
    Nov 16 at 6:16










  • Just added an example. Thanks.
    – Pedro S.
    Nov 16 at 11:30










  • I think this example might be not enough to understand the problem. At least for me.
    – Jaroslaw Matlak
    Nov 16 at 12:23










  • @Jaroslaw Matlak , I changed the example, I hope it's clearer.
    – Pedro S.
    Nov 16 at 13:09










  • I don't have a solution for you, but maybe someone else does? So, I'll try to put your question in symbols: Given a series X=$[x_1, x_2, ... x_n, ...]$ and a function $y_k = f(x, k) = f_k(x_{k-i+1}, x_{k-i+2},..., x_{k})$, you want to know if it possible to find the range of $x_{n+1}$ given $x_1$ to $x_n$, such that $y_{n+1} le r$. Am I correct, or did I miss something?
    – tpb261
    yesterday




















  • I'm not sure I understand your problem. Can you give a small example and update the question?
    – tpb261
    Nov 16 at 6:16










  • Just added an example. Thanks.
    – Pedro S.
    Nov 16 at 11:30










  • I think this example might be not enough to understand the problem. At least for me.
    – Jaroslaw Matlak
    Nov 16 at 12:23










  • @Jaroslaw Matlak , I changed the example, I hope it's clearer.
    – Pedro S.
    Nov 16 at 13:09










  • I don't have a solution for you, but maybe someone else does? So, I'll try to put your question in symbols: Given a series X=$[x_1, x_2, ... x_n, ...]$ and a function $y_k = f(x, k) = f_k(x_{k-i+1}, x_{k-i+2},..., x_{k})$, you want to know if it possible to find the range of $x_{n+1}$ given $x_1$ to $x_n$, such that $y_{n+1} le r$. Am I correct, or did I miss something?
    – tpb261
    yesterday


















I'm not sure I understand your problem. Can you give a small example and update the question?
– tpb261
Nov 16 at 6:16




I'm not sure I understand your problem. Can you give a small example and update the question?
– tpb261
Nov 16 at 6:16












Just added an example. Thanks.
– Pedro S.
Nov 16 at 11:30




Just added an example. Thanks.
– Pedro S.
Nov 16 at 11:30












I think this example might be not enough to understand the problem. At least for me.
– Jaroslaw Matlak
Nov 16 at 12:23




I think this example might be not enough to understand the problem. At least for me.
– Jaroslaw Matlak
Nov 16 at 12:23












@Jaroslaw Matlak , I changed the example, I hope it's clearer.
– Pedro S.
Nov 16 at 13:09




@Jaroslaw Matlak , I changed the example, I hope it's clearer.
– Pedro S.
Nov 16 at 13:09












I don't have a solution for you, but maybe someone else does? So, I'll try to put your question in symbols: Given a series X=$[x_1, x_2, ... x_n, ...]$ and a function $y_k = f(x, k) = f_k(x_{k-i+1}, x_{k-i+2},..., x_{k})$, you want to know if it possible to find the range of $x_{n+1}$ given $x_1$ to $x_n$, such that $y_{n+1} le r$. Am I correct, or did I miss something?
– tpb261
yesterday






I don't have a solution for you, but maybe someone else does? So, I'll try to put your question in symbols: Given a series X=$[x_1, x_2, ... x_n, ...]$ and a function $y_k = f(x, k) = f_k(x_{k-i+1}, x_{k-i+2},..., x_{k})$, you want to know if it possible to find the range of $x_{n+1}$ given $x_1$ to $x_n$, such that $y_{n+1} le r$. Am I correct, or did I miss something?
– tpb261
yesterday

















active

oldest

votes











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Pedro S. is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3000776%2fcalculate-boundries-within-which-r-remains-above-a-critical-value-given-correl%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








Pedro S. is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















Pedro S. is a new contributor. Be nice, and check out our Code of Conduct.













Pedro S. is a new contributor. Be nice, and check out our Code of Conduct.












Pedro S. is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3000776%2fcalculate-boundries-within-which-r-remains-above-a-critical-value-given-correl%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

'app-layout' is not a known element: how to share Component with different Modules

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

WPF add header to Image with URL pettitions [duplicate]