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

[EquisMetaStock Group] Re: every x period moving average (seasonally adjusted)



PureBytes Links

Trading Reference Links

excellent!! this is just what i was looking for. may i ask one more 
question? what if i wanted to change the formula to make it so it 
skips 2 days, as opposed to one day, or skips even 3 days? i tried 
to change the inputs with no luck.

also, changing this line in the formula:

Cl:=ValueWhen(1,signal,Ref(C,-1));

to

Cl:=ValueWhen(1,signal,Ref(C,-2));

only seems to have an affect on the starting point, but the moving 
average calculation is still skipping just one. to elaborate....


$1, $2, $3, $4, $5, $6, $7, $8, $9

the original formula you provided used ((8+6)/2)=7 to correspond 
with price $9, and ((7+5)/2)=6 to correspond with $8.


changing Ref(C,-2) to Ref(C,-1) in the formula makes it so 
((7+5)/2)=6 corresponds with $9 and ((6+4)/2)=5 corresponds with $8. 
the starting point skipped two, but the formula itself is still only 
skipping one. 

how would i make it so the -formula- skips two (or three, or four) 
as well? so price $9 would have a moving average point of 
((7+4))/2)=5.5 and $8 would have ((6+3)/2)=4.5 ?


i cannot thank you enough. this is the last time i will waste your 
time :)

Adam




--- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@xxx> wrote:
>
> Adam,
> 
> The math looks right to me.
> 
> Your formula says to use the close 2 days ago and smooth 2 days at 
a 
> time. (6+7)/2 = 6.50
> 
> 
> If you want to skip a day use
> 
> pds:=Input("Nth bar periodicity",1,252,2);
> pdsma:=Input("Smoothing periods",1,100,2);
> signal:=Mod(Cum(1),pds)=0;
> Cl:=ValueWhen(1,signal,Ref(C,-1));
> mov(Cl,pdsma,S){end}
> 
> Preston
> 
> 
> 
> --- In equismetastock@xxxxxxxxxxxxxxx, juzam66666 <no_reply@> 
> wrote:
> >
> > hi preston,
> > 
> > I took your advice and looked into the metastock help, which of 
> > course helped a lot! this is the formula i came up with:
> > 
> > mov( Ref(CLOSE,-2), 2, SIMPLE)
> > 
> > unfortunately, it's a little off what i was looking for, but 
very 
> > close.
> > 
> > say, the latest prices for a stock are (from earliest to latest):
> > 
> > $1, $2, $3, $4, $5, $6, $7, $8, $9
> > 
> > the formula in its current state calculates the moving average 
> point 
> > for $9 as $6.50 ((7+6)/2). I was looking for something like $6, 
> > which would be (($7+$5)/2). For the $8 day it currently 
calculates 
> > the moving average point as $5.50, but should be $5.
> > 
> > 
> > Thank You a million!
> > 
> > 
> > --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@> wrote:
> > >
> > > Adam,
> > > 
> > > Think about what you are asking.
> > > 
> > > If you calculate a value every 5 days then for the next 5 days 
> > your 
> > > value is held constant...stairstep. 
> > > 
> > > If you wish to calculate from a value 5 days ago then just use 
> > that 
> > > value. You could use the ref statement for that...ref(close,-
5). 
> > > This would change every day but remember its data from 5 days 
> ago. 
> > > You are automaticaaly introducing lag by doing this.
> > > 
> > > Yes you can plot the highest value or lowest value over a 
period 
> > of 
> > > time by using the HHV or LLV. You can even direct it over a 
> period 
> > > of time. Rather than tell you how to do this open metastock 
and 
> > > click on the help icon at the top. Select Metastock help and 
> > index. 
> > > Then simply scroll down until you get to highest or lowest. 
> Select 
> > > it and it will explain what you need.
> > > 
> > > I would also tell you to go to our links section and check out 
> > some 
> > > of the formula sites that you will find there. This is a quite 
> > > extensive list and you should learn to use them.
> > > 
> > > hope this helps,
> > > 
> > > Preston
> > > 
> > > 
> > > 
> > > 
> > > 
> > > --- In equismetastock@xxxxxxxxxxxxxxx, juzam66666 <no_reply@> 
> > > wrote:
> > > >
> > > > thank you so much for all your help! i really apreciate it. 
> just 
> > > to 
> > > > clarify, though, is it not possible to create an nth bar sma 
> > > without 
> > > > the stair-step look and without smoothing (as in actually 
> > > > calculating the nth bar sma for each and every point)?
> > > > 
> > > > on a separate but somewhat related note: is there a formula 
> that 
> > > for 
> > > > point X on a graph (say, the latest data point), it would 
take 
> > day
> > > >  x-5 (5 days ago), x-10, x-15, x-20, and x-25  and plot the 
> > > highest 
> > > > value? or lowest value? 
> > > > 
> > > > 
> > > > This forum is a gem; I've learned a lot browsing. Thank you 
> for 
> > > all 
> > > > your time,
> > > > 
> > > > Adam
> > > > 
> > > > --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@> 
> wrote:
> > > > >
> > > > > juzam,
> > > > > 
> > > > > I gave you this:
> > > > > 
> > > > > pds:=Input("Nth bar periodicity",1,252,5);
> > > > > pdsma:=Input("Smoothing periods",1,100,21);
> > > > > signal:=Mod(Cum(1),pds)=0;
> > > > > Cl:=ValueWhen(1,signal,Ref(C,-1));
> > > > > mov(Cl,pdsma,S){end}
> > > > > 
> > > > > 
> > > > > It calculates every 5 days. If you want a longer period 
just 
> > set 
> > > > the 
> > > > > Nth bar periodicity to a longer period. If you set it at 
252 
> > you 
> > > > > will get approximately one year. 
> > > > > 
> > > > > Preston
> > > > > 
> > > > > 
> > > > > 
> > > > > --- In equismetastock@xxxxxxxxxxxxxxx, juzam66666 
> <no_reply@> 
> > > > > wrote:
> > > > > >
> > > > > > Thanks for all the help guys. I tried the nth bar sma, 
but 
> > it 
> > > > > didn't 
> > > > > > seem to come out quite like i was thinking. ill try to 
> > > > > > expand...basically what im trying to get is a seasonally-
> > > > adjusted 
> > > > > > moving average. 
> > > > > > 
> > > > > > so the latest data point is, say, 625 on date 3/20/2007. 
> the 
> > > > > moving 
> > > > > > average would calculate, for example, the five-year 
> > seasonally 
> > > > > > adjusted sma. to calculate this it would average the 
data 
> > > points 
> > > > > on 
> > > > > > 3/20/2006, 3/20/2005, 3/20/2004, 3/20/2003, and 
3/20/2002. 
> > for 
> > > > the 
> > > > > > moving average point a day earlier, on 3/19/2007 it 
would 
> do 
> > > the 
> > > > > same 
> > > > > > calculations for 3/19/2006, 3/19/2005, etc. 
> > > > > > 
> > > > > > note that the 625 is basically irrelevent because it 
isn't 
> > in 
> > > > the 
> > > > > sma 
> > > > > > until 3/20/2008 comes along
> > > > > > 
> > > > > > thank you so much for any help
> > > > > >
> > > > >
> > > >
> > >
> >
>




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/equismetastock/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:equismetastock-digest@xxxxxxxxxxxxxxx 
    mailto:equismetastock-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/