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, 1. Your graph is still on your "C:" drive; it's not visible here. Use IMGUR and its BBCODE option to put inside your forum msgs. 2. >>Can you supply your version of the code? Um, actually, it's YOUR code, though I did take the "-1" out for StdDev, and reformat to check the logic. 3. >>The amplitude of my indicators seem to be different from yours and I would like to figure out why. Thanks! You might right-click the plot and make sure both are on the same scale (right or left). *** FLASH *** I just noticed that you had (and I copied) the division by "n" for "variance", and did it again for the "sd" calculation, using "n-1" (dividing twice, when it should only be once). I have taken out the 2nd one, but IT DID NOT MAKE ANY DIFFERENCE in the graph. Now THAT is DECIDEDLY strange! The custom formula for Standard Error still doesn't match. Anyway, here's the code: Code:{Variance}
n:= 5; {number of data}
mn:=
(
CLOSE
+Ref(CLOSE,-1)
+Ref(CLOSE,-2)
+Ref(CLOSE,-3)
+Ref(CLOSE,-4)
)/n; {mean}
variance:=
(
Power(CLOSE - mn,2)
+ Power(Ref(CLOSE,-1) - mn,2)
+ Power(Ref(CLOSE,-2) - mn,2)
+ Power(Ref(CLOSE,-3) - mn,2)
+ Power(Ref(CLOSE,-4) - mn,2)
)/n; {variance}
variance
Code:{Standard Deviation} n:= 5; {number of data}
mn:= ( CLOSE +Ref(CLOSE,-1) +Ref(CLOSE,-2) +Ref(CLOSE,-3) +Ref(CLOSE,-4) )/n; {mean}
variance:= ( Power(CLOSE - mn,2) + Power(Ref(CLOSE,-1) - mn,2) + Power(Ref(CLOSE,-2) - mn,2) + Power(Ref(CLOSE,-3) - mn,2) + Power(Ref(CLOSE,-4) - mn,2) )/n; {variance}
sd:= Sqrt(variance); {standard deviation}
sd;
Code:{Standard Error Code}
n:= 5; {number of data}
mn:=
(
CLOSE
+Ref(CLOSE,-1)
+Ref(CLOSE,-2)
+Ref(CLOSE,-3)
+Ref(CLOSE,-4)
)/n; {mean}
variance:=
(
Power(CLOSE - mn,2)
+ Power(Ref(CLOSE,-1) - mn,2)
+ Power(Ref(CLOSE,-2) - mn,2)
+ Power(Ref(CLOSE,-3) - mn,2)
+ Power(Ref(CLOSE,-4) - mn,2)
)/n; {variance}
sd:=Sqrt(variance); {standard deviation}
se:=sd/Sqrt(n); {standard error}
se;
|