PureBytes Links
Trading Reference Links
|
Not sure that change is a good one.
Produce Marketing Association
Photo Marketing Association
Precision Metalforming Association
Pacific Maritime Association
Promotion Marketing Association
Pilates Method Alliance
Philippine Military Academy
Property Management Association
Just for a start...
;-)
>From: "Jose Silva" <josesilva22@xxxxxxxxx>
>Reply-To: equismetastock@xxxxxxxxxxxxxxx
>To: equismetastock@xxxxxxxxxxxxxxx
>Subject: [EquisMetaStock Group] Phased MA for MetaStock
>Date: Mon, 15 Jan 2007 23:13:31 -0000
>
>My last posted code may have generated some confusion - better to change
>"JMA" for "PMA" just in case some of these good people get upset:
>
>JMA Inc.
>JMA Forensics
>JMA Groups
>JMA Graphics
>JMA Software
>JMA Legal
>JMA Consulting
>JMA Engineering
>Japan Medical Association
>Japan Meteorological Agency
>Japan Management Association
>Japan Marketing Association
>Jamaica Manufacturers' Association
>John Mitchell & Associates
>Jurik Moving Average
>
>
>MetaStock -> Tools -> Indicator Builder -> New
>-> copy & paste complete formula between "---8<---" lines.
>
>===========
>MA - phased
>===========
>---8<-----------------------------------------
>
>{ PMA v1.0 -- Phased Moving Average.
> As suggested by Mark Jurik of Jurik Research,
> http://www.jurikres.com
>
> ©Copyright 2007 Jose Silva.
> For personal use only.
> http://www.metastocktools.com }
>
>{ User inputs }
>pds:=Input("PMA periods",1,2600,21);
>factor:=Input("Lag reduction scaling factor [-1 = Auto]",-1,1000,-1);
>x:=Input("use [1]Open [2]High [3]Low [4]Close [5]WCl [6]Vol",1,6,4);
>type:=Input("[1]EMA [2]SMA [3]TmSr [4]Tri [5]Var [6]Vol [7]Wght",1,7,2);
>shift:=Input("PMA bands spread %",0,100,5)/100;
>plot:=Input("[1]PMA, [2]PMA+Bands, [3]Band crossover Signals",1,3,1);
>
>{ Data array }
>x:=If(x=1,O,
> If(x=2,H,
> If(x=3,L,
> If(x=4,C,
> If(x=5,WC(),
> V)))));
>
>{ MovAvg type:
> 1 - Exponential MA
> 2 - Simple MA
> 3 - Time Series MA
> 4 - Triangular MA
> 5 - Variable MA
> 6 - Volume adjusted MA
> 7 - Weighted MA }
>ma:=
> If(type=1,Mov(x,pds,E),
> If(type=2,Mov(x,pds,S),
> If(type=3,Mov(x,pds,T),
> If(type=4,Mov(x,pds,TRI),
> If(type=5,Mov(x,pds,VAR),
> If(type=6,Mov(x,pds,VOL),
> Mov(x,pds,W)))))));
>
>{ PMA approximation }
>factor:=If(factor>=0,factor,pds/4);
>PMA:=(ma+LinRegSlope(x,pds)*factor);
>
>{ PMA % bands }
>upper:=PMA*(1+shift);
>lower:=PMA*(1-shift);
>
>{ PMA bands crossover signals }
>entry:=Cross(C,upper);
>exit:=Cross(lower,C);
>
>{ Clean signals }
>init:=Cum(IsDefined(entry+exit))=1;
>bin:=ValueWhen(1,entry-exit<>0 OR init,entry);
>long:=bin*(Alert(bin=0,2)
> OR entry*Cum(entry)=1);
>short:=(bin=0)*(Alert(bin,2)
> OR exit*Cum(exit)=1);
>signals:=long-short;
>
>{Plot PMA on price chart, signals in own window}
>If(plot=1,PMA,If(plot=2,upper,0));
>If(plot=1,PMA,If(plot=2,lower,0));
>If(plot=3,signals,PMA)
>
>---8<-----------------------------------------
>
>
>jose
>http://www.metastocktools.com
>
>
>
>
> > --- In equismetastock@xxxxxxxxxxxxxxx, "Mark
> > Jurik" <mark_yahoo_equismetastock@> wrote:
> >
> > The code is simply a combination of a simple moving average and one
> > way of approximating overall slope:
> >
> > Result = SMA + slope
> >
> > You can get the desired slope calc in MS by using the built-in linear
> > regression slope function. This way, ...
> >
> > Result = mov( data array, periods, simple )
> > +
> > linregslope( data array, periods ) * scaling_factor
> >
> > You set the scaling factor as in input parameter, which allows you to
> > adjust the amount of lag reduction. This approach to achieving low
> > lag smoothing is NOT adaptive and has a significant overshoot penalty
> > in proportion to the amount of lag reduction you request.
> >
> > This formula poorly approximates JMA, which is adaptive, non-linear
> > and has better lag/overshoot tradeoff properties. If you want the
> > real thing, go to http://www.jurikres.com .
> >
> > Mark Jurik
> > Jurik Research
>
>
>
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/
|