Hourly OHLC data

Questions about MultiCharts and user contributed studies.
whitefox
Posts: 14
Joined: 19 Jul 2012
Has thanked: 4 times

Hourly OHLC data

Postby whitefox » 10 Dec 2012

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.

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Hourly OHLC data

Postby furytrader » 10 Dec 2012

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?

whitefox
Posts: 14
Joined: 19 Jul 2012
Has thanked: 4 times

Re: Hourly OHLC data

Postby whitefox » 10 Dec 2012

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.

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Hourly OHLC data

Postby furytrader » 10 Dec 2012

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;

whitefox
Posts: 14
Joined: 19 Jul 2012
Has thanked: 4 times

Re: Hourly OHLC data

Postby whitefox » 10 Dec 2012

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)

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Hourly OHLC data

Postby furytrader » 10 Dec 2012

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.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Hourly OHLC data

Postby TJ » 10 Dec 2012

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 ">="


Return to “MultiCharts”