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

RE: [EquisMetaStock Group] Re: How to remove 3 highest/lowest values in a range



PureBytes Links

Trading Reference Links

Jose,

Believe me I know MS's limitations! I was just curious when you use the same 
name twice, does MS "process" just the 2nd one or both? Also, your 2nd use 
of xBoxedPrds itself refers to xBoxedPeriods 
[xBoxedPds:=If(xBoxedPds=0,.000001,xBoxedPds);] - can this create errors? 
Finally, in the the last argument 
[xBoxedAvg:=Sum(If(x=xBoxed,x,0),pds)/xBoxedPds;], MS will refer to which 
xBoxedPrds - the 1st or the 2nd? Just curious to know...

JD
=======================================================

From: "Jose" <josesilva22@xxxxxxxxx>
Reply-To: equismetastock@xxxxxxxxxxxxxxx
To: equismetastock@xxxxxxxxxxxxxxx
Subject: [EquisMetaStock Group] Re: How to remove 3 highest/lowest values in 
a range
Date: Tue, 23 Mar 2004 01:58:50 -0000

John,

Unfortunately MetaStock provides limited formula space (2.5Kb) and
variable count (20).  Often we need to reuse variables just to get by.

But in this case, I'm just modifying xBoxedPds to avoid division by
zero errors, so I find it appropriate to reuse this variable.
Rename any variables to any name that suits you.

Take care not to lose sight of the forest by concentrating on the
trees.

jose '-)



--- In equismetastock@xxxxxxxxxxxxxxx, "John Doe" <ms001122@xxxx>
wrote:
 > Great job, but 2 minor Qs just occurred to me, Jose.
 > 1) You have xBoxedPds used twice, each time with a different
formula;
 > perhaps you should rename one of them to avoid any confusion
 > 2) You think LoMin should be renamed to LoMax as that appears more
 > appropriate?
 >
 > JD
 > ==========================================
 >
 > From: "Jose" <josesilva22@xxxx>
 > Reply-To: equismetastock@xxxxxxxxxxxxxxx
 > To: equismetastock@xxxxxxxxxxxxxxx
 > Subject: [EquisMetaStock Group] Re: How to remove 3 highest/lowest
values in
 > a range
 > Date: Fri, 19 Mar 2004 12:09:20 -0000
 >
 >
 > John, ignore my last post.
 > This is closer to what you want:
 >
 > ==========
 > Box filter
 > ==========
 > ---8<-----------------
 >
 > { Box filter v2.2 }
 > { Filters out three-highest/lowest values }
 > { ©Copyright 2004 Jose Silva }
 > { http://users.bigpond.com/prominex/pegasus.htm }
 > { Insert price or indicator formula
 >    to be box-filtered below}
 > x:=Mo(5);
 >
 > pds:=Input("Box filter lookback periods",
 >   2,2520,21);
 >
 > Hi1:=HHV(x,pds);
 > Hi2:=HHV(ValueWhen(1,x<Hi1,x),pds);
 > Hi3:=HHV(ValueWhen(1,x<Hi2,x),pds);
 > HiMin:=Min(Hi1,Min(Hi2,Hi3));
 >
 > Lo1:=LLV(x,pds);
 > Lo2:=LLV(ValueWhen(1,x>Lo1,x),pds);
 > Lo3:=LLV(ValueWhen(1,x>Lo2,x),pds);
 > LoMin:=Max(Lo1,Max(Lo2,Lo3));
 >
 > HiLim:=Max(HiMin,LoMin);
 > LoLim:=Min(HiMin,LoMin);
 > xBoxed:=If(x>HiLim,HiLim,If(x<LoLim,LoLim,x));
 > xBoxedPds:=Sum(x=xBoxed,pds);
 > xBoxedPds:=If(xBoxedPds=0,.000001,xBoxedPds);
 > xBoxedAvg:=Sum(If(x=xBoxed,x,0),pds)/xBoxedPds;
 >
 > x;xBoxedAvg;xBoxed
 >
 > ---8<-----------------
 >
 > jose '-)
 >
 >
 > --- In equismetastock@xxxxxxxxxxxxxxx, "Jose" <josesilva22@xxxx>
 > wrote:
 >  > > 3) I don't get what the denominator is for.
 >  > The +.000001 bit is there to avoid division by zero errors.
 >  >
 >  > I think a simple moving average of the output will work best,
even
 > if
 >  > it includes boxed-in limit values. Anything else requires a
 >  > variable-periods sum() function.
 >  >
 >  > Try this:
 >  >
 >  > ==========
 >  > Box filter
 >  > ==========
 >  > ---8<----------------------
 >  >
 >  > { Box filter v2.1 }
 >  > { Filters out three-highest/lowest values }
 >  > { ©Copyright 2004 Jose Silva }
 >  > { http://users.bigpond.com/prominex/pegasus.htm }
 >  > { Insert price or indicator formula
 >  >   to be box-filtered below}
 >  > x:=Mo(5);
 >  >
 >  > pds:=Input("HHV/LLV lookback periods",
 >  >  2,2520,21);
 >  >
 >  > Hi1:=HHV(x,pds);
 >  > Hi2:=HHV(ValueWhen(1,x<Hi1,x),pds);
 >  > Hi3:=HHV(ValueWhen(1,x<Hi2,x),pds);
 >  > HiMin:=Min(Hi1,Min(Hi2,Hi3));
 >  >
 >  > Lo1:=LLV(x,pds);
 >  > Lo2:=LLV(ValueWhen(1,x>Lo1,x),pds);
 >  > Lo3:=LLV(ValueWhen(1,x>Lo2,x),pds);
 >  > LoMin:=Max(Lo1,Max(Lo2,Lo3));
 >  >
 >  > HiLim:=Max(HiMin,LoMin);
 >  > LoLim:=Min(HiMin,LoMin);
 >  > xBoxed:=If(x>HiLim,HiLim,If(x<LoLim,LoLim,x));
 >  > xBoxedAvg:=Mov(xBoxed,pds,S);
 >  >
 >  > xBoxedAvg;x;xBoxed
 >  >
 >  > ---8<----------------------
 >  >
 >  > jose '-)
 >
 >
 >
 >
 >
 >
 > Yahoo! Groups Links
 >
 >
 >
 >
 > _________________________________________________________________
 > Get rid of annoying pop-up ads with the new MSN Toolbar – FREE!
 > http://clk.atdmt.com/AVE/go/onm00200414ave/direct/01/





Yahoo! Groups Links




_________________________________________________________________
All the action. All the drama. Get NCAA hoops coverage at MSN Sports by 
ESPN. http://msn.espn.go.com/index.html?partnersite=espn



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/BefplB/TM
---------------------------------------------------------------------~->

 
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/