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

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



PureBytes Links

Trading Reference Links

John, use this last version of the box filter code:

==========
Box filter
==========
---8<----------------------------

{ Box filter v2.0 }
{ Filters out three-highest/lowest values }
{ ©Copyright 2004 Jose Silva }
{ http://users.bigpond.com/prominex/pegasus.htm }
{ Insert price or indicator formula 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));

x;xBoxed

---8<----------------------------


For the average I would simply replace the last line of code by:

---8<----------------------------
xOk:=x=xBoxed;
If(xOK,Sum(If(xOk,x,0),pds)/(xOk+.000001),0)
---8<----------------------------

jose '-)


--- In equismetastock@xxxxxxxxxxxxxxx, "John Doe" <ms001122@xxxx> 
wrote:
> Jose, you are just amazing :-)
> Now, if I was to calculate the mean of the remaining 14 values (20 
values - 
> 6 removed =14), I guess I would use something like this:
> (Sum(x,20) -Hi1 -Hi2 -Hi3 -Lo1 -Lo2 -Lo3) /14.
> Correct me if I am wrong...
> 
> JD




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