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

Notification

Icon
Error

Options
Go to last post Go to first unread
Biff Malibu  
#1 Posted : Monday, December 10, 2007 8:15:37 PM(UTC)
Biff Malibu

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/21/2005(UTC)
Posts: 33

I've got the formula primer right in front of me, and I'm trying to reference a percentage of the 50-day moving average, 50 days ago.

for the %age of the 50 day moving average I use

((c-mov(c,50,s)/mov(c,50,s))*100;

then to try and reference that value 50 periods ago I try this

ref(((c-mov(c,50,s)/mov(c,50,s))*100,-50);

and I'm getting some really messed up numbers...

Please Help! I only made it to Calculus 1 in college and I got a C in it!

Thanks

Biff

johnl  
#2 Posted : Wednesday, December 12, 2007 10:14:01 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

Only Wabbit and Jose can do that embedded stuff and survive. Write your code like this and it
is a bit easier to read and change.
{------------------------}
a1:=Mov(C,50,S); {my moving average}
a2:=((C-a1)/a1)*100; {my percent}
a3:=Ref(a2,-50); {my reference}
a3 {my plot}
{------------------------}
If variable a3 looks strange, you go backwards and plot each variable, a2, a1, etc . to find the error.
Hope this helps.

Biff Malibu  
#3 Posted : Thursday, December 13, 2007 9:11:58 AM(UTC)
Biff Malibu

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/21/2005(UTC)
Posts: 33

Thanks for the help my good friend, I'll try that, it looks like it should work.

Merry Christmas, thanks again

Biff

Biff Malibu  
#4 Posted : Thursday, December 13, 2007 9:20:40 AM(UTC)
Biff Malibu

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/21/2005(UTC)
Posts: 33

Arghhh...for column 2, it says I can't use the column function in that way...argh

oztrader  
#5 Posted : Thursday, December 13, 2007 6:51:06 PM(UTC)
oztrader

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Biff,

Your initial code was so close to being correct - just one ")" in the wrong place which will affect the results of both formulae.

Try these codes and see whether the results are acceptable.

(C-Mov(C,50,S))/Mov(C,50,S)*100;

Ref((C-Mov(C,50,S))/Mov(C,50,S)*100,-50);

Johnl's code is also correct but cannot be used in an exploration unless you delete the last line.

Good back testing!

Biff Malibu  
#6 Posted : Friday, December 14, 2007 5:37:19 AM(UTC)
Biff Malibu

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/21/2005(UTC)
Posts: 33

that did the trick! thanks for all your help!

Biff

Users browsing this topic
Guest (Hidden)
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.