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

Re: [amibroker] Re: median calculation



PureBytes Links

Trading Reference Links

Hi Bob,

Thanks for the response. The only problem is that I want to chart some further calculations in AB which will be dependent on the median calculation - so Excel won't get it.

All I can think of is to run a loop which first sets the HHV of the array to zero, then finds the next highest value, assign it to x, set THAT high value in the array to zero, then look for the next high value and average it with x. Then do the same for the negative values in the array to find the median of the four lowest troughs.

Even if I figure out how to do that, it seems awfully clumsy. There has to be a better way, but I have a feeling it's going to involve some kind of nested loop in VBscript or something, to sort them out. I haven't written anything serious in 20 years, and I've forgotten most of the how-to-do-it solutions I found then.

While writing this, I noticed your follow-up response mentioning bubble sorts. I'm not familiar with the term, but I have the feeling it involves what I considered in the last paragraph.

Still stumped, but plugging away...

DC
  ----- Original Message ----- 
  From: Bob Jagow 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Friday, November 05, 2004 4:08 PM
  Subject: RE: [amibroker] Re: median calculation


  Since "The Median function - finds median (middle element) value of the
  array over period elements", you'd have to identify the "four highest
  peaks within a user-defined lookback range  as well as the four lowest
  troughs below zero" and try to stuff them into a new array in order to
  use it.
  I'd suggest Excel in preference to AB.

  Regards,
  Bob


  -----Original Message-----
  From: conn_dennis [mailto:dennisconn@xxxxxxxxxxxxxxxx]
  Sent: Friday, November 05, 2004 12:26 PM
  To: amibroker@xxxxxxxxxxxxxxx
  Subject: [amibroker] Re: median calculation




  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






  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










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

  Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 


        Yahoo! Groups Sponsor 
         
        Get unlimited calls to

        U.S./Canada
       
       


------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/
      
    b.. To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 





------------------------------------------------------------------------------

  Message transport security by GatewayDefender
  4:11:03 PM ET - 11/5/2004

[Non-text portions of this message have been removed]



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