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

RE: [EquisMetaStock Group] modifying Centred MA



PureBytes Links

Trading Reference Links

This is one possible projection solution that we came up with a few weeks
ago with help from Jose and Roy. Its hard wired for a 9-day average, but
gives one idea of how to do it. Like any projection its less reliable the
further out it goes.


Cyclical MA Projection (9)

{with help from Jose & Roy}
P1:=9;
Pr:=(O+H+L+C)/4;
MA:=Mov(Pr,P1,TRI);
Shift:=Round(p1/2);
center:=LastValue(Shift);
CMA:=Ref(MA,center);
y:=LastValue(CMA+PREV-PREV);
CMA:=If(y>0,y,Pr);
CMA1:=Ref(Mov(Pr,P1-1,TRI),center-1);
y:=LastValue(CMA1+PREV-PREV);
CMA1:=If(y>0,y,Pr);
CMA2:=Ref(Mov(Pr,P1-2,TRI),center-2);
y:=LastValue(CMA2+PREV-PREV);
CMA2:=If(y>0,y,Pr);
CMA3:=Ref(Mov(Pr,P1-3,TRI),center-3);
y:=LastValue(CMA3+PREV-PREV);
CMA3:=If(y>0,y,Pr);
CMA4:=Ref(Mov(Pr,P1-4,TRI),center-4);
y:=LastValue(CMA4+PREV-PREV);
CMA4:=If(y>0,y,Pr);
CMA5:=Ref(Mov(Pr,P1-5,TRI),center-5);
y:=LastValue(CMA5+PREV-PREV);
CMA5:=If(y>0,y,Pr);

CMAP:=
If(Cum(1)=LastValue(Cum(1)-center+1),CMA1,
If(Cum(1)=LastValue(Cum(1)-center+2),CMA2,
If(Cum(1)=LastValue(Cum(1)-center+3),CMA3,
If(Cum(1)=LastValue(Cum(1)-center+4),CMA4,
If(Cum(1)=LastValue(Cum(1)-center+5),CMA5,CMA)))));CMAP;

Andrew

-----Original Message-----
From: equismetastock@xxxxxxxxxxxxxxx [mailto:equismetastock@xxxxxxxxxxxxxxx]
On Behalf Of lowtarhk
Sent: Thursday, June 16, 2005 4:15 PM
To: equismetastock@xxxxxxxxxxxxxxx
Subject: [EquisMetaStock Group] modifying Centred MA


Hi traders,

I am trying to modify Jose's Centred MA that extends the last MA 
value to the last trading date.

I hope to replace the extended part of the MA using an estimated 
curve or a straight line with last few MA values.

As shown below, I calucalate the difference of the last 2 MA values 
(maybe a +ve or -ve difference) and then add the difference to the 
last MA values recursively.

But i failed to show the desired result after a number of trials.

Could you kindly advise on the algorithm. Thanks in advance for the 
help.

Chu
 
==========================================


{ Centered MA - v2.0 }
{ Uses forward-referencing to center Mov Avg.}

{ Copyright 2005 Jose Silva
  For personal use only.
  http://www.metastocktools.com }

{ User inputs }
pds:=Input("MA periods",1,2600,10);
type:=Input("[1]EMA [2]SMA [3]TmSr [4]Tri [5]Var [6]Vol [7] Wght",1,7,2);

{ Choose MA 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(C,pds,E),
 If(type=2,Mov(C,pds,S),
 If(type=3,Mov(C,pds,T),
 If(type=4,Mov(C,pds,TRI),
 If(type=5,Mov(C,pds,VAR),
 If(type=6,Mov(C,pds,VOL),
 Mov(C,pds,W)))))));

{ Forward-reference MA }
center:=LastValue(Int(pds/2));
fwd:=Ref(ma,center);

{ Extend plot into null zone }
xtend:=LastValue(fwd+PREV-PREV);

{******* the line i add **********}
{extending using a straight line}
xtend:=If(xtend=Ref(xtend,-1),Ref(xtend,-1)*2-Ref(xtend,-2),xtend);

{ Restrict invalid initial MA plot } ma:=Ref(Ref(xtend,pds-1),-pds+1);

{ Plot MA on price chart }
ma







 
Yahoo! Groups Links



 






 
Yahoo! Groups Links

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

<*> 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/