in Search

Plz Help! Can't figure out how to reference a %age of a MA x number of days ago...

Last post 12-14-2007, 5:37 by Biff Malibu. 5 replies.
Sort Posts: Previous Next
  •  12-10-2007, 20:15 26010

    Plz Help! Can't figure out how to reference a %age of a MA x number of days ago...

    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

     

  •  12-12-2007, 22:14 26026 in reply to 26010

    Re: Plz Help! Can't figure out how to reference a %age of a MA x number of days ago...

     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.
     
  •  12-13-2007, 9:11 26036 in reply to 26026

    Re: Plz Help! Can't figure out how to reference a %age of a MA x number of days ago...

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

    Merry Christmas, thanks again

    Biff

     

  •  12-13-2007, 9:20 26038 in reply to 26036

    Re: Plz Help! Can't figure out how to reference a %age of a MA x number of days ago...

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

     

  •  12-13-2007, 18:51 26046 in reply to 26038

    Re: Plz Help! Can't figure out how to reference a %age of a MA x number of days ago...

    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!

  •  12-14-2007, 5:37 26051 in reply to 26046

    THANK YOU OZTRADER

    that did the trick!  thanks for all your help!

    Biff

     

View as RSS news feed in XML