[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weekly moving avg on Daily chart



PureBytes Links

Trading Reference Links

Yesterday I said that my weekly 50 ma sometimes was slightly
off.  The problem wasn't that Metastock sometimes calcs out 2
decimal places and sometimes 3 as I said.  (It just sometimes
displays data that way.)  I think I must have been the only
one buying that line. <g>   The error was on my part...I put
an erroneous lookback period in the 50 ma Calc2  indicator.  I
corrected it so now it's accurate.

Everything checked out fine today.  The ma's and high/lows all
plot on the current day.  I like this setup much better, and
the lag was due to an unnecessary line of code.  Seems like
I'm always trying to complicate things. :-)   I've been
reminded that attachments don't make it through to digest
subscribers so I included both text and files for the ma's.
If someone on the digest wants the current version weekly
high/low/closes, e-mail me privately.  (Too much cut/paste to
deal with.)  Let me know if you find any errors or an easier
way to do it.  I haven't figured out how to simplify it with
the Sum function yet.  Not sure it's possible, but it sure
would be nice.  All indicators in the files start with a  `
for grouping.

Regards,
Ken
--
mailto:divenfish@xxxxxxxxxxxxx
=========================
    `10 per Wkly SMA for DAILY Chart
a:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
b:=
ValueWhen(1,a=1,(Ref(C,-1)+
ValueWhen(2,a=1,Ref(C,-1))+
ValueWhen(3,a=1,Ref(C,-1))+
ValueWhen(4,a=1,Ref(C,-1))+
ValueWhen(5,a=1,Ref(C,-1))+
ValueWhen(6,a=1,Ref(C,-1))+
ValueWhen(7,a=1,Ref(C,-1))+
ValueWhen(8,a=1,Ref(C,-1))+
ValueWhen(9,a=1,Ref(C,-1))+
ValueWhen(10,a=1,Ref(C,-1)))/10);
b
==========================
   `2 per Wkly SMA for DAILY Chart
a:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
b:=
ValueWhen(1,a=1,(Ref(C,-1)+
ValueWhen(2,a=1,Ref(C,-1)))/2);
b
===========================
    `20 per Wkly SMA for DAILY Chart
a:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
b:=
ValueWhen(1,a=1,(Ref(C,-1)+
ValueWhen(2,a=1,Ref(C,-1))+
ValueWhen(3,a=1,Ref(C,-1))+
ValueWhen(4,a=1,Ref(C,-1))+
ValueWhen(5,a=1,Ref(C,-1))+
ValueWhen(6,a=1,Ref(C,-1))+
ValueWhen(7,a=1,Ref(C,-1))+
ValueWhen(8,a=1,Ref(C,-1))+
ValueWhen(9,a=1,Ref(C,-1))+
ValueWhen(10,a=1,Ref(C,-1))+
ValueWhen(11,a=1,Ref(C,-1))+
ValueWhen(12,a=1,Ref(C,-1))+
ValueWhen(13,a=1,Ref(C,-1))+
ValueWhen(14,a=1,Ref(C,-1))+
ValueWhen(15,a=1,Ref(C,-1))+
ValueWhen(16,a=1,Ref(C,-1))+
ValueWhen(17,a=1,Ref(C,-1))+
ValueWhen(18,a=1,Ref(C,-1))+
ValueWhen(19,a=1,Ref(C,-1))+
ValueWhen(20,a=1,Ref(C,-1)))/20);
b
====================
    `25 per Wkly SMA for DAILY Chart
a:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
b:=
ValueWhen(1,a=1,(Ref(C,-1)+
ValueWhen(2,a=1,Ref(C,-1))+
ValueWhen(3,a=1,Ref(C,-1))+
ValueWhen(4,a=1,Ref(C,-1))+
ValueWhen(5,a=1,Ref(C,-1))+
ValueWhen(6,a=1,Ref(C,-1))+
ValueWhen(7,a=1,Ref(C,-1))+
ValueWhen(8,a=1,Ref(C,-1))+
ValueWhen(9,a=1,Ref(C,-1))+
ValueWhen(10,a=1,Ref(C,-1))+
ValueWhen(11,a=1,Ref(C,-1))+
ValueWhen(12,a=1,Ref(C,-1))+
ValueWhen(13,a=1,Ref(C,-1))+
ValueWhen(14,a=1,Ref(C,-1))+
ValueWhen(15,a=1,Ref(C,-1))+
ValueWhen(16,a=1,Ref(C,-1))+
ValueWhen(17,a=1,Ref(C,-1))+
ValueWhen(18,a=1,Ref(C,-1))+
ValueWhen(19,a=1,Ref(C,-1))+
ValueWhen(20,a=1,Ref(C,-1))+
ValueWhen(21,a=1,Ref(C,-1))+
ValueWhen(22,a=1,Ref(C,-1))+
ValueWhen(23,a=1,Ref(C,-1))+
ValueWhen(24,a=1,Ref(C,-1))+
ValueWhen(25,a=1,Ref(C,-1)))/25);
b
======================
    `3 per Wkly SMA for DAILY Chart
a:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
b:=
ValueWhen(1,a=1,(Ref(C,-1)+
ValueWhen(2,a=1,Ref(C,-1))+
ValueWhen(3,a=1,Ref(C,-1)))/3);
b
=======================
    `4 per Wkly SMA for DAILY Chart
a:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
b:=
ValueWhen(1,a=1,(Ref(C,-1)+
ValueWhen(2,a=1,Ref(C,-1))+
ValueWhen(3,a=1,Ref(C,-1))+
ValueWhen(4,a=1,Ref(C,-1)))/4);
b
======================
   `5 per Wkly SMA for DAILY Chart
a:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
b:=
ValueWhen(1,a=1,(Ref(C,-1)+
ValueWhen(2,a=1,Ref(C,-1))+
ValueWhen(3,a=1,Ref(C,-1))+
ValueWhen(4,a=1,Ref(C,-1))+
ValueWhen(5,a=1,Ref(C,-1)))/5);
b
=========================
    `50 per Wkly SMA Calc1 for DAILY Chart
{This performs the first calc for the
50 per Wkly SMA for DAILY Chart This is necessary
due to the max numeric constants allowable per formula. -Ken
3/30/99}

a:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
b:=
ValueWhen(1,a=1,(Ref(C,-1)+
ValueWhen(2,a=1,Ref(C,-1))+
ValueWhen(3,a=1,Ref(C,-1))+
ValueWhen(4,a=1,Ref(C,-1))+
ValueWhen(5,a=1,Ref(C,-1))+
ValueWhen(6,a=1,Ref(C,-1))+
ValueWhen(7,a=1,Ref(C,-1))+
ValueWhen(8,a=1,Ref(C,-1))+
ValueWhen(9,a=1,Ref(C,-1))+
ValueWhen(10,a=1,Ref(C,-1))+
ValueWhen(11,a=1,Ref(C,-1))+
ValueWhen(12,a=1,Ref(C,-1))+
ValueWhen(13,a=1,Ref(C,-1))+
ValueWhen(14,a=1,Ref(C,-1))+
ValueWhen(15,a=1,Ref(C,-1))+
ValueWhen(16,a=1,Ref(C,-1))+
ValueWhen(17,a=1,Ref(C,-1))+
ValueWhen(18,a=1,Ref(C,-1))+
ValueWhen(19,a=1,Ref(C,-1))+
ValueWhen(20,a=1,Ref(C,-1))+
ValueWhen(21,a=1,Ref(C,-1))+
ValueWhen(22,a=1,Ref(C,-1))+
ValueWhen(23,a=1,Ref(C,-1))+
ValueWhen(24,a=1,Ref(C,-1))+
ValueWhen(25,a=1,Ref(C,-1)))/25);
b
===============================
   `50 per Wkly SMA Calc2 for DAILY Chart
{This performs the second calc for the
50 per Wkly SMA for DAILY Chart }

a:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
b:=
ValueWhen(1,a=1,
(ValueWhen(26,a=1,Ref(C,-1))+
ValueWhen(27,a=1,Ref(C,-1))+
ValueWhen(28,a=1,Ref(C,-1))+
ValueWhen(29,a=1,Ref(C,-1))+
ValueWhen(30,a=1,Ref(C,-1))+
ValueWhen(31,a=1,Ref(C,-1))+
ValueWhen(32,a=1,Ref(C,-1))+
ValueWhen(33,a=1,Ref(C,-1))+
ValueWhen(34,a=1,Ref(C,-1))+
ValueWhen(35,a=1,Ref(C,-1))+
ValueWhen(36,a=1,Ref(C,-1))+
ValueWhen(37,a=1,Ref(C,-1))+
ValueWhen(38,a=1,Ref(C,-1))+
ValueWhen(39,a=1,Ref(C,-1))+
ValueWhen(40,a=1,Ref(C,-1))+
ValueWhen(41,a=1,Ref(C,-1))+
ValueWhen(42,a=1,Ref(C,-1))+
ValueWhen(43,a=1,Ref(C,-1))+
ValueWhen(44,a=1,Ref(C,-1))+
ValueWhen(45,a=1,Ref(C,-1))+
ValueWhen(46,a=1,Ref(C,-1))+
ValueWhen(47,a=1,Ref(C,-1))+
ValueWhen(48,a=1,Ref(C,-1))+
ValueWhen(49,a=1,Ref(C,-1))+
ValueWhen(50,a=1,Ref(C,-1)))/25);
b
=====================
    `50 per Wkly SMA for DAILY Chart
a:=If(DayOfWeek()<=Ref(DayOfWeek(),-1),1,0);
b:=
ValueWhen(1,a=1,
(FmlVar("`50 per Wkly SMA CALC1 for DAILY Chart"
,"b") +
FmlVar("`50 per Wkly SMA CALC2 for DAILY Chart"
,"b"))/2);
b
===============================
    `Wkly SMA's for DAILY Chart
{This plots user selected WEEKLY simple ma's
on DAILY charts. -Ken  3/30/99}

n:=
Input("periods 2,3,4,5,10,20,25,or 50",2,50,4);
z:=
If(n=2,
FmlVar("`2 per Wkly SMA for DAILY Chart","b"),
If(n=3,
FmlVar("`3 per Wkly SMA for DAILY Chart","b"),
If(n=4,
FmlVar("`4 per Wkly SMA for DAILY Chart","b"),
If(n=5,
FmlVar("`5 per Wkly SMA for DAILY Chart","b"),
If(n=10,
FmlVar("`10 per Wkly SMA for DAILY Chart","b"),
If(n=20,
FmlVar("`20 per Wkly SMA for DAILY Chart","b"),
If(n=25,
FmlVar("`25 per Wkly SMA for DAILY Chart","b"),
If(n=50,
FmlVar("`50 per Wkly SMA for DAILY Chart","b"),
0))))))));
z
============================
============================


Attachment Converted: "c:\eudora\attach\movAvg.zip"

Attachment Converted: "c:\eudora\attach\closeHiLows.zip"