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

Re: Arrrgh!!! Call for Simple(?) ELA Help, Please



PureBytes Links

Trading Reference Links

At 11:15 AM -0700 8/25/99, Richard wrote:

>
>I've been tearing my hair out over what seems to me to be such a simple
>ELA programing question:
>
>What I'm seeking is: How Many Bars Have Elapsed in the Past X Seconds?
>


The function below returns the number of ticks per minute each minute 
or each bar, whichever is longer. Perhaps you can modify this to do 
what you need.

Bob Fulks



{ *******************************************************************
 
    Function:     TicksPerMin
 
    Last Edit:    3/22/99

    Coded By:     Bob Fulks

    Description:  Calculates ticks per minute on intraday charts
                 (Based upon an idea from Randall Kurzon)

    Errors:       Returns -1 on other than intraday charts.

********************************************************************}
Var:  Tks(0), TPM(0), Tim1(0), Ctr(0);

if DataCompression = 0 then begin

    Tim1 = TimetoMinutes(Time);

    if Tim1 <> Tim1[1] then begin
       TPM = Tks;
       Tks = Ticks;
    end else Tks = Tks + Ticks;

end else if DataCompression = 1 then begin

    TPM = Ticks / BarInterval;

end else TPM = -1;

TicksPerMin = TPM;