PureBytes Links
Trading Reference Links
|
At 10:40 AM 5/23/2005, ericzhou wrote:
>How can I code " Close of 10AM + Close of Today - Close of Yesterday"?
I assume you are using an intraday chart that contains a 10AM bar.
If you want the true daily close you also need daily data as data2. This will not be the same as the last intraday closing price.
If you are happy with the last intraday price of the day then you can say:
--------------------------
Vars: DayClose(0), TenAM(0), MyVal(0);
if Time = 1000 then TenAM = Close;
if Date <> Date[1] then begin
DayClose = Close[1];
MyVal = TenAM + DayClose - DayClose[1];
end;
--------------------------
This will be available on the first bar of the next day.
If you are using daily data for data2 this should work:
--------------------------
Vars: DayClose(0), TenAM(0), MyVal(0);
if Time = 1000 then TenAM = Close;
if Date data1 = Date data2 then begin
DayClose = Close data2;
MyVal = TenAM + DayClose - DayClose[1];
end;
--------------------------
This will be available on the last bar of the day.
Bob Fulks
|