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

Re: fast implementation for circular buffer or stack



PureBytes Links

Trading Reference Links

Bob:

Thank you again for the code.
This circular buffer algorithm looks pretty nice.

Leslie


Bob Fulks wrote:
> 
> At 7:13 PM -0500 11/16/02, Leslie Walko wrote:
> 
> >If FIFO is NOT an accessible data structure from EL, does
> >anyone have a fast implementation FIFO implementation coded
> >in EL?
> >
> >(For example, a ping-pong buffer is a fast way to simulate a
> >FIFO queue -- and I do not mind wasting memory for speed.)
> 
> The attached Equity Profile indicator uses a circular buffer to avoid
> moving the values in memory.
> 
> This code stores the values in the circular buffer array:
> 
>     ACE[Countr] = CE;
>     Countr = Mod(Countr + 1, Size);
> 
> This code sequentially plots the values in the array in the proper
> location:
> 
> if LastBarOnChart then begin
>     for J = 0 to Size - 1 begin
>        K = Mod(Countr + J, Size);
>        Plot[Size - 1 - J](ACE[K], "");
>     end;
> end;
> 
> The actual code is a bit more complex but this will give you the idea.
> 
> Bob Fulks
> 
>                    Name: EQPRFILE.ELA
>    EQPRFILE.ELA    Type: EasyLanguage Archive File (application/x-unknown-content-type-EasyLanguageArchiveFile)
>                Encoding: base64

-- 
Regards,
Leslie Walko
610-688-2442
--
 "Life is a tragedy for those who feel, a comedy for those
who think"
	Horace Walpole, 4th earl of Orford, in a letter dated about
1770