[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

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

Attachment: Description: "EQPRFILE.ELA"

Attachment: Description: "%EQPRFILE.ELA"