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

Re: OHLC Hourly function



PureBytes Links

Trading Reference Links

At 11:16 AM 4/1/2004, cosmictrader wrote:

>has anyone coded a function for retrieving hourly OHLC in intraday charts? 



On thinking about this, I realized that what to do might not be so apparent so I finished the code. This seems to work OK.

The values produced match the values of a second 60 minute data series on the same symbol.

Bob Fulks

---------

Vars: MyHigh(0), MyLow(999999), MyOpen(0), HrHigh(0), HrLow(0), 
      HrOpen(0), HrClose(0);

MyHigh = iff(High > MyHigh, High, MyHigh);
MyLow  = iff(Low < MyLow, Low, MyLow);
MyOpen = iff(MyOpen = 0, Open, MyOpen);
if Mod(TimeToMinutes(Time), 60) = 0 then begin
   HrOpen = MyOpen;
   HrHigh = MyHigh;
   HrLow = MyLow;
   HrClose = Close;
   MyHigh = 0;
   MyLow = 999999; 
   MyOpen = 0;
end;

Print(Date:7:0, Time:5:0, HrOpen:8:2, HrHigh:8:2, HrLow:8:2, HrClose:8:2);