[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

> 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 '-)


--- In equismetastock@xxxxxxxxxxxxxxx, "John Doe" <ms001122@xxxx> 
wrote:
> Jose, there are 3 issues:
> 1) When I plot the indicator using your latest formula, its value 
fluctuates 
> between some value and zero; it should never go down to zero.
> 2) I suspect your calculated average is too low, since it sums the 
values of 
> x over user-specified periods, substituting the 3 highest & lowest 
values 
> with a zero, and then divides the resultant total by "pds", 
forgetting that 
> 6 values have been excluded;
> 3) I don't get what the denominator is for.
> 
> JD




 
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/