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

[Metastockusers] Re: Variable Moving Average initialization



PureBytes Links

Trading Reference Links

Roy:

In your previous post in this thread, you included this as part of your example:

VIDYA:=If(Cum(1)<=(Smooth+2),C,(SC*AbsCMO*CLOSE)+(1-(SC*AbsCMO))*PREV);
If(Sum(C,Smooth+2)>0,VIDYA,VIDYA);

So this must mean that a "data array" can be a defined variable (VIDYA is your example).

Can I use the same idea in something like the Input() function for an Indicator? For example, could I do something like this, to input the symbol of the security that I want to use in the Indicator:

A1:=Input("Enter Symbol",GM,GE,IBM);
Mov(Security("A1",C),30,S)

Harry

--- In Metastockusers@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx> wrote:
> Gary
> 
> Seeding the appropriate bar is the key thing here.
> If(Cum(1)<=(Smooth+2),C,
> 
> and then forcing the output to have the appropriate number of N/A bars is as
> simple as forcing it to the known N/A period any function you care to use.
> If(Sum(C,Smooth+2)>0,VIDYA,VIDYA);
> 
>   {VIDYA (9,20)}
> Length:=Input("Length",1,200,9);
> Smooth:=Input("Smoothing",1,200,20);
> AbsCMO:=(Abs(CMO(C,Length)))/100;
> SC:=2/(Smooth+1);
> VIDYA:=If(Cum(1)<=(Smooth+2),C,(SC*AbsCMO*CLOSE)+(1-(SC*AbsCMO))*PREV);
> If(Sum(C,Smooth+2)>0,VIDYA,VIDYA);
> 
> Some extra information. Notice how it is possible to seed an EMA on bar one
> in the following EMA code. The fact that the plot doesn't start until bar
> two is down to the PREV function.
> 
>   {Exponential Moving Average}
> A:=Input("Periods",1,99,20);
> B:=P; {target data array - usually CLOSE}
> R:=2/(A+1);
> If(Cum(1)=1,B,PREV*(1-R)+B*R);
> 
> Roy
> 
> ----- Original Message ----- 
> From: "Gary" <garyk176@xxxx>
> To: <Metastockusers@xxxxxxxxxxxxxxx>
> Sent: Thursday, July 17, 2003 7:00 PM
> Subject: [Metastockusers] Variable Moving Average initialization
> 
> 
> > Can anyone shed light on how I could initialize a Variable Moving
> > Average in the same way that Metastock's built-in VMA indicator is
> > initialized?  This indicator is based on Chande's VIDYA, which uses
> > Chande's CMO as a volatility index to control the rate of change of
> > the variable moving average.  The built-in VMA is based on a 9-period
> > CMO, and if the selected length of the moving average is 10, it
> > appears that MetaStock waits 9 bars to calculate the starting CMO
> > value, then begins calculating the moving average, so it's about 20
> > bars before the first value of the MA is plotted.  And, that first
> > value appears to be the close of the initial bar.
> >
> > When I attempt to duplicate this in the indicator builder, using
> > formulas from the Guppytraders site as a starting point, my indicator
> > starts at the 10th bar for a 10-period moving average, so I'm
> > obviously starting the calculation of both the CMO-based volatility
> > index and the MA itself, together on the first bar.  In addition,
> > depending on how I use the IF() and Cum() functions to initialize it,
> > the initial values of the VMA are either at or near zero, or using
> > the close for the first several bars, which means it takes quite a
> > while for the weight of those incorrect initial values to drop enough
> > that my VMA stabilizes and matches the MetaStock version.
> >
> > Seems to me that it would be helpful if I had a MetaStock equivalent
> > of the Excel =N/A function - the indicator simply wouldn't exist to
> > be plotted until a specified bar, and the first calculated value
> > would simply be based on the close of the previous bar.  Using the IF
> > and CUM functions, the best I can do is have two alternative
> > calculations for before and after the desired bar, rather than simply
> > starting the calculation at the desired bar and having NO value for
> > the indicator prior to that point.  Any suggestions, anyone?
> >
> > Thank you.
> >
> > Gary
> >
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > Metastockusers-unsubscribe@xxxxxxxxxxx
> >
> >
> >
> > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >
> >
> >
> >


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Natural Vitamins for Good Prostate & Male Health. $28.97
http://www.challengerone.com/t/l.asp?cid=2865&lp=prosta2.html
http://us.click.yahoo.com/qJIe0D/89VGAA/ySSFAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

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