Hello, can someone tell me how the “Linear Regression Slope” indicator is calculated in ProRealTime? I tried following the indicator description instructions, but I am getting different values…
Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums.Thanks 🙂
I moved it from the Italian forum.
Which indicator?
Ah, ok, scusatemi… credevo che l’inglese fosse un po’ la lingua “universale” del Forum….
Comunque, parlavo della “Pendenza di Regressione Lineare”, io ho provato a ricostruire l’indicatore servendomi della seguente formula:
Slope = (N * Sum(xy) – Sum(x) * Sum(y)) / (N * Sum(x^2) – (Sum(x))^2)
ma non sono riuscito ad ottenere alcunchè, oppure ottengo valori sballati, per cui volevo sapere qual è il codice applicato su Prorealtime per ottenere il suddetto indicatore.
Grazie in anticipo.
Ah, ok, sorry… I thought that English was somewhat of the “universal” language of the Forum….
However, I was talking about the “Linear Regression Slope”, I tried to reconstruct the indicator using the following formula:
Slope = (N * Sum(xy) – Sum(x) * Sum(y)) / (N * Sum(x^2) – (Sum(x))^2)
but I wasn’t able to get anything, or I get incorrect values, so I wanted to know what code is applied on Prorealtime to obtain the aforementioned indicator.
Thanks in advance.
JSParticipant
Senior
Hi Brian,
Try this one:
Sumx=0
Sumy=0
Sumx2=0
Sumxy=0
N=10
For i=1 To N
x=i
y=Close[i-1]
Sumx=Sumx+x
Sumy=Sumy+y
Sumx2=Sumx2+(x*x)
Sumxy=Sumxy+(x*y)
Next
Slope=(N*Sumxy-Sumx*Sumy)/(N*Sumx2-(Square(Sumx)))*-1
Return Slope
@brian gilbert
please stick to the chosen language. Thanks 🙂
Sorry, but i don’t understand if i must write in italian or english… however, thank’s a lot for your helping.
Read the basic rules highlighted in yellow below.
Choose the correct language forum and stick to it, using only that language.
You chose the Italian forum but you used the English to write your first post. I then switched it to the English forum.
Use only the English language here.
Should you create a new topic you may choose any one of the supported languages, but then stick to it, please 🙂
You chose the Italian forum but you used the English to write your first post. I then switched it to the English forum.
Which is a most unclear thing to do. Please don’t blame the user/customer. Instead blame yourself. Or at least don’t bash the user for it.