logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages<12
Options
Go to last post Go to first unread
wabbit  
#21 Posted : Friday, January 20, 2012 5:37:26 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
So you mean something more akin to:

Code:

{== Residual Standard Error ==}

prd:=14;
data:=CLOSE;

{-- KEEP OUT --}

x:=cum(1);
y:=data;

sumX:=Sum(X,prd);
sumY:=Sum(Y,prd);
sumXX:=Sum(X*X,prd);
sumYY:=Sum(Y*Y,prd);
sumXY:=Sum(X*Y,prd);

aa:=sumYY-(Power(sumY,2)/prd);
bb:=sumXY-(sumX*sumY/prd);
cc:=SumXX-(Power(sumX,2)/prd);
dd:=sumXY-(sumX*sumY/prd);

num:=aa-bb/cc*dd;
den:=prd-2;

rse:=Sqrt(num/den);

{plot}
rse;




wabbit [:D]

Alan R  
#22 Posted : Friday, January 20, 2012 7:36:52 AM(UTC)
Alan R

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 9/23/2009(UTC)
Posts: 51

Wabbit:

Yes! Thanks for the efficient code. Not claiming to be a programmer I wrote my code in such a way as I could understand what is actually taking place in calculating the residual standard error. I appreciate your code very much as it shows how the residual standard error code should actually be written.

As verification I plotted your code on top of the MetaStock code STE() and they do overlay as I am sure you did. I am just adding this as a note for others

Again, thanks Wabbit and Johnathan for your inputs in helping be to understand what STE() actually measures.

Alan,

wabbit  
#23 Posted : Friday, January 20, 2012 7:47:56 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
You're welcome.

What's the next indicator to take apart?



wabbit [:D]

jjstein  
#24 Posted : Friday, January 20, 2012 5:18:37 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Alan R wrote:
OK guys, how do I use the quote feature?


Click QUOTE instead of REPLY.

jjstein  
#25 Posted : Friday, January 20, 2012 5:32:26 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Alan R wrote:
As verification I plotted your code on top of the MetaStock code STE() and they do overlay as I am sure you did. I am just adding this as a note for others


Hmmmm. I'm late to the party, but it doesn't quite match exactly...try a period of 10 or 21.

Also, anything under 7 periods gives a "Negative Square Root" error.

I'm using the S&P 500 to test.

wabbit  
#26 Posted : Friday, January 20, 2012 7:38:46 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
There will be some small differences, we only have access to single precision math, whereas the built-in indicators have much higher precision available. This is also the issue where precision errors sometimes make the numerator negative, so just trap that error.

Code:

x:=If(num<=0,0,num/den);

rse:=Sqrt(x);

{plot}
rse;



wabbit [:D]

Users browsing this topic
Guest (Hidden)
Similar Topics
Standard Error Channel (Formula Assistance)
by Derek Worswick 9/21/2016 2:50:12 PM(UTC)
Relative standard error (Formula Assistance)
by michmauro 10/20/2012 10:18:10 AM(UTC)
Standard Error Indicator - What does it indicate? (Advanced Coding Techniques)
by Alan R 1/18/2012 9:20:04 AM(UTC)
Standard Error Bands (Formula Assistance)
by Patrick 8/19/2005 4:41:49 PM(UTC)
2 Pages<12
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.