PureBytes Links
Trading Reference Links
|
Juzam, try the variable-bar SMA indicator below:
======================
SMA - variable Nth bar
======================
---8<-------------------------------------
{ Variable Nth bar Simple Moving Average v1.0
©Copyright 2007 Jose Silva.
The grant of this license is for personal use
only - no resale or repackaging allowed.
http://www.metastocktools.com }
{ User inputs }
pds1:=Input("Average Close in every Nth bar",1,260,5);
pds2:=Input("SMA periods",1,520,4);
shift:=1+Input("SMA vertical shift %",
-100,100,0)/100;
plot:=Input("[1]SMA, [2]Nth bar, [3]Crossover signals",1,3,1);
{ Nth bar signals }
NthBar:=Mod(Cum(1),pds1)=0;
{ Nth bar's Close }
NthCl:=ValueWhen(1,NthBar,C);
NthCl:=ValueWhen(1,NthCl<>0,NthCl);
{ Nth-bar SMA }
z:=Cum(NthBar*NthCl);
NthSma:=(z-ValueWhen(pds2+1,NthBar,z))/pds2;
{ Vertical shift }
NthSma:=NthSma*shift;
{ Crossover signals }
signals:=Cross(C,NthSma)-Cross(NthSma,C);
{ Plot SMA on price chart }
If(plot=1,NthSma,If(plot=2,NthBar,signals))
---8<-------------------------------------
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, juzam66666 <no_reply@xxx> wrote:
>
> hi all,
>
> i was curious if anyone knew how to create a moving average that
> averaged every x periods. it would be like a regular moving average,
> except it would skip....for example, a 20day sma with x=2, it would
> average every other day for 20 periods. x=5 would average every 5 days
> for 20 periods.
>
> appreciate any help you can offer.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Transfer from your equities account.
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~->
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/
|