Page 1 of 1

Hourly OHLC data

Posted: Dec 10 2012
by whitefox
Is it possibly to get OHLC intraday data? At the moment I'm particularly interested in getting hourly data. I see there is an OHLCPeriodsAgo function but that seems to only work for daily data and above. I have not found a function that allows me to just pull intraday close data for a given instrument and interval type on a give date.

Re: Hourly OHLC data

Posted: Dec 10 2012
by furytrader
I think it's possible but I'm having difficulty understanding the specific application. Can you outline specifically what you want to be able to do?

Re: Hourly OHLC data

Posted: Dec 10 2012
by whitefox
I think it's possible but I'm having difficulty understanding the specific application. Can you outline specifically what you want to be able to do?
I'm writing a pivot point indicator. For trading currencies I want the user to be able to specify the hour on which the day is considered to be 'closed'. If it uses the close of my day (PST) the pivot points will be totally wrong; I would like to be able to use the price at 5pm EST as the EOD price and then calculate highs and lows from 5pm to 5pm.

Re: Hourly OHLC data

Posted: Dec 10 2012
by furytrader
If you were using hourly bars, you could do something like this:

Input: SessionEnd(1700);
Vars: DayHigh(0), DayLow(0);

If H > DayHigh Then DayHigh = H;
If L < DayLow Then DayLow = L;

If Time = SessionEnd Then Begin
// Insert pivot calculations here
// Then reset day High and day low - either to current bar or some fixed max / min values
DayHigh = H;
DayLow = L;
End;

Re: Hourly OHLC data

Posted: Dec 10 2012
by whitefox
If you were using hourly bars, you could do something like this:

Input: SessionEnd(1700);
Vars: DayHigh(0), DayLow(0);

If H > DayHigh Then DayHigh = H;
If L < DayLow Then DayLow = L;

If Time = SessionEnd Then Begin
// Insert pivot calculations here
// Then reset day High and day low - either to current bar or some fixed max / min values
DayHigh = H;
DayLow = L;
End;
But what if I want to use tick charts? (which I do)

Re: Hourly OHLC data

Posted: Dec 10 2012
by furytrader
With tick charts, instead of saying time = sessionend, you'd say something like:

if time[1] < sessionend and time > sessionend then ...

Note that there's going to be some slippage, depending on how active the market is around sessionend time.

Re: Hourly OHLC data

Posted: Dec 10 2012
by TJ
With tick charts, instead of saying time = sessionend, you'd say something like:

if time[1] < sessionend and time > sessionend then ...

Note that there's going to be some slippage, depending on how active the market is around sessionend time.
you can do it this way to give yourself finer resolution:

Code: Select all

if time_s[1] < sessionend*100 and time_s >= sessionend*100 then ...

note the ">="