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

Re: test for last bar?



PureBytes Links

Trading Reference Links

At 9:22 AM -0500 11/10/00, Alex Dannenberg wrote:

>I have a chart w/ 5 min bars for data1 and data2 and daily bars for data 3.
>
>I'd like to perform an action at the close of each day, but haven't figured
>out how to do so.
>
>When I attempt to identify the last 5 min bar of the day by trying " If Date
><> Date of Next Bar then...."  I get the error message "Cannot mix next bar
>prices with data streams other than data1".  BTW, I'm definitely not making
>any reference to data2 or data3 in the statement that's failing...
>
>Any idea how to identify the last 5 min bar of the day without looking at
>the next one?!

The usual technique is to wait until the first bar of the day then refer to the values of variables back one bar. For example:

   NP = NetProfit;

   if Date <> Date[1] then begin
      XXX = Close[1];
      YYY = NP[1];
   end;

This usually works for finding values but not for issuing signal for the first bar of the day.

You can also say:

   if Time = 1615 then .....
   if Time = Sess1EndTime then .....

and this works if there is a bar with that time stamp. It usually works except on days when the market closes early.

Bob Fulks