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

Re: [Metastockusers] Re: Variable Moving Average initialization



PureBytes Links

Trading Reference Links

Hi Harry

I don't see the connection that you make. If() is not restricted to using
constants so it can do pretty much anything yo want. Whether what you're
suggesting would work or not I really don't know but I doubt that Input()
will allow non-numeric operands. I assume you've tried it without success?

The only way I can see this working is to use, say,
A:=Input("Enter Symbol",1,3,1);
B:=If(A,Mov(Security("GM",C),30,S),
If(Mov(Security("GE",C),30,S),
Mov(Security("IBM",C),30,S))); {have not tested this, sorry}

Of course you would be restricted by the 2499 charracters available but
space could be saved by calling the security in 'A' without the Mov() and
doing the move afterwards.

I guess is not much helpas I'm sure you've tried it already.

Regards

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: <DEFANGED_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/
> > >
> > >
> > >
> > >
>
>
>
> 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 ---------------------~-->
Free shipping on all inkjet cartridge & refill kit orders to US & Canada. Low prices up to 80% off. We have your brand: HP, Epson, Lexmark & more.
http://www.c1tracking.com/l.asp?cid=5510
http://us.click.yahoo.com/GHXcIA/n.WGAA/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/