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

[Metastockusers] Re: How to calculate this ?



PureBytes Links

Trading Reference Links

--- In Metastockusers@xxxxxxxxxxxxxxx, "Karile" <karile@xxxx> wrote:
> 
> Hi,
> 
> I would like to know if it is possible with Mestatock to calculate a 
median
> (statistically speaking) :
> 
> The median is the middle number (value) in any given set of numbers 
(values)
> :
> 
> For example :
> 
> A set of values :
> 
>  20 45 10 3 90 19
> 
> 1) We have to classify (rising order) these values : so
> 
> 3 10 19 20 45 90
> 
> 2) Because we have an even set of numbers ( 6 values) :
> 
> We take the value 19 and the value 20 :
> 
> (19+20)/2 = 19.5 = MEDIAN
> 
> 3) for an odd set of numbers
> 
> Let's take the same set of numbers but with 5 values (odd number) :
> 
> 20 45 10 3 90
> 
> We classify :
> 
> 3 10 20 45 90
> 
> MEDIAN = 20 (the number which divides in two the set of numbers)
> 
> 
> Is it possible to do the same thing thing with Metastock (I would 
like to do
> it with 100 values) ?
> 
> Any help appreciated,
> 
> Regards,
> 
> Karile

Hi, Karile

I don't know what exactly your intention here is of course but if your 
100 values represent the lookback period of a time series, you're 
probably defeating your purpose. A 100-bar median filter would have 
approximately the same result as a 100-bar moving average with the 
same disadvantage: about 50 bars of lag.

I use a 3-bar median filter as a "prefilter" or "preprocessor" when I 
make indicators of price velocity in order to "snap off the jaggies" 
because velocity is noisier than raw price. The cost is only one bar 
of lag, but that is more than paid back by being able to use a shorter 
MA on the smoother output of the prefilter.

There is a general-purpose median algorithm somewhere on the Net but 
it is pretty complicated and probably involves looping.  For short 
medians, there are more efficient algorithms.

For the 3-bar median filter:

Median := Max(Max(Min(P, Ref(P,-1)),Min(P, Ref(P,-2))), Min(Ref(P,-1), 
Ref(P,-2)));

HTH,
kut2k2

> ----- Original Message -----
> From: "Roy Larsen" <rlarsen@xxxx>
> To: <Metastockusers@xxxxxxxxxxxxxxx>
> Sent: Monday, May 05, 2003 10:43 PM
> Subject: Re: [Metastockusers] BINARY WAVE COMPOSITE
> 
> 
> > Debra Ann
> >
> > I should have written the conditions as "condition A" etc. 
Following is
> the
> > same code with real conditions which you need to replace with your 
own.
> This
> > is for demonstration only.
> >
> > If(  C>Ref(HHV(C,5),-1)  ,1,0)+
> > If(  C>Ref(HHV(C,10),-1)  ,2,0)+
> > If(  C>Ref(HHV(C,15),-1)  ,4,0)+
> > If(  C>Ref(HHV(C,20),-1)  ,8,0);
> >
> > Roy
> >
> > ----- Original Message -----
> > From: "Debra Ann Petitan" <DrDAP@xxxx>
> > To: <Metastockusers@xxxxxxxxxxxxxxx>
> > Sent: Tuesday, May 06, 2003 7:33 AM
> > Subject: Re: [Metastockusers] BINARY WAVE COMPOSITE
> >
> >
> > >
> > > Roy,
> > >
> > > I received an error message saying "condition" is not a 
recognized name
> or
> > operator.  Do I leave that word out of the formula?
> > >
> > > Thank you,
> > > Debra Ann
> > > --- "Roy Larsen" <rlarsen@xxxx> wrote:
> > > >Debra Ann
> > > >
> > > >It is quite easy to set up a "sort of" binary wave that assigns
> different
> > > >values to the different conditions. This could be rather 
confusing with
> > > >negative numbers but I've used the following format to help 
quickly
> > identify
> > > >which signals were true.
> > > >
> > > >If(condition "A",1,0)+
> > > >If(condition "B",2,0)+
> > > >If(condition "C",4,0)+
> > > >If(condition "D",8,0);
> > > >
> > > >The possible results are 0 through 15.
> > > >
> > > >In the example above a summed value of 10 tells us that 
conditions B
> and
> > D
> > > >are true. A value of 3 results from A and B. Once beyond four
> components
> > the
> > > >mental maths gets a little harder.
> > > >
> > > >Roy
> > > >
> > > >> On page 289 of the 8.0 MetaStock manual, a composite Binary 
Wave is
> > > >> listed.
> > > >> Is there a way of distinguishing each wave from the other so 
when the
> > > >> wave is generated at 1, 2, or 3, you would be able to tell 
which
> > > >> indicator was not in agreement with the other three.  Or if 
only 1 is
> > > >> +/-1 which indicator that would be?
> > > >> Could something be color coded or named or a number assigned 
to each
> > > >> indicator to reflect its identity?
> > > >> If this is possible, would someone please write the 
additional lines
> > > >> necessary to accomplish this goal?
> > > >>
> > > >> Thank you very much.
> > > >> Debra Ann
> > > >>
> > > >>
> > > >>
> > > >> 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/
> > >
> > > _____________________________________________________________
> > > Calling all cartoon fans!
> > >
> > > Garfield keeps millions of newspaper readers laughing over their 
morning
> > corn flakes...now he's waddling into cyberspace to spread his 
mirth (and
> > girth)!
> > >
> > > You can now get the full-color Garfield comic strip e-mailed to 
you
> every
> > day of the week -- absolutely FREE! Just go to
> > http://www.garfield.com/signup/ to register!
> > >
> > >
> > > 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 ---------------------~-->
Rent DVDs from home.
Over 14,500 titles. Free Shipping
& No Late Fees. Try Netflix for FREE!
http://us.click.yahoo.com/BVVfoB/hP.FAA/uetFAA/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/