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

[amibroker] Re: median calculation



PureBytes Links

Trading Reference Links


Dennis,
The 4 last peaks of H [for per=10] are

per=10;
//Plot(H,"H",colorBlack,1);Plot(Zig(H,per),"",colorYellow,1);
Title="";
for(J=1;J<5;J++)
{
 X=ValueWhen(PeakBars(H,per)==0,H,J);
Title=Title+"\nH"+WriteVal(j,1.0)+"="+WriteVal(x);
}

Their average will be
per=5;av=0;j0=4;
Plot(H,"H",colorBlack,1);Plot(Zig(H,per),"",colorYellow,1);
Title="";
for(J=1;J<=4;J++)
{
 X=ValueWhen(PeakBars(H,per)==0,H,J);
av=av+x;
Title=Title+"\nH"+WriteVal(j,1.0)+"="+WriteVal(x);
}
Title=Title+"\nHav="+WriteVal(av/j0);

Dimitris
--- In amibroker@xxxxxxxxxxxxxxx, "conn_dennis" <dennisconn@xxxx> 
wrote:
> 
> So was the question that stupid, or hasn't anyone ever attempted it?
> 
> Anyone???
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "conn_dennis" <dennisconn@xxxx> 
> wrote:
> > 
> > I know that the median function will return the median value of 
the 
> > entire array, but how would one go about finding the median of 
only 
> > some of the values in an array?
> > 
> > So far, I've managed only to identify the peaks in an oscillator 
> I've 
> > coded, but I'm trying to have the program find the median of ONLY 
> the 
> > four highest peaks within a user-defined lookback range (likewise 
> > with the four lowest troughs below zero).
> > 
> > I think I can stumble around and figure out how to code what I 
need 
> > once I get past this median problem. I've spent two days on this 
> > trying to figure it out (I feel like Thomas Edison - I've 
> discovered 
> > a thousand ways to NOT find the median). : )
> > 
> > Has anyone had a similar problem and found a somewhat simple 
> > solution, or perhaps be willing to point me in some direction?
> > 
> > DC





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/