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

How to detect the very last bar in a series???



PureBytes Links

Trading Reference Links

I need to detect the very last bar in a series.  Pierre Orphelin's
finddate(-1) DLL function seems to give undefined results on the last
bar, so the best I could do was come up with the "BarIsLast" function
below which incorporates finddate.  It seems to do the job, but I'm not
sure how reliably it will work in the long term.  [Note that I need to
be able to do this from indicators & systems, thus I can't use "date of
next bar".]  Hopefully one of you might know of a better way...

Thanks & rgds,
Bernie
----------
Variables:
   BarDateNext(0),
   BarYearNext(0),
   BarYear(0);

definedllfunc:"c:\omega\prog\ts_find.dll",dword,"findDate",lpword,int;

BarDateNext = findDate(&date,-1);
BarYearNext = Year(BarDateNext);
BarYear	    = Year(Date);

BarIsLast = BarYearNext<>BarYear and BarYearNext<>BarYear+1;

-------- 
Bernard Orenstein - Agents Pty Limited
PO Box 956  North Turramurra  NSW 2074  Australia
Tel:(02)9440-0920  Fax:(02)9440-0921  Mobile:(0417)279-238
Email: bernie@xxxxxxxxxxxxx    Web: http://www.agents.com.au