Hourly OHLC data
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.
- furytrader
- Posts: 354
- Joined: Jul 30 2010
- Location: Chicago, IL
- Has thanked: 155 times
- Been thanked: 217 times
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.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?
- furytrader
- Posts: 354
- Joined: Jul 30 2010
- Location: Chicago, IL
- Has thanked: 155 times
- Been thanked: 217 times
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;
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)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;
- furytrader
- Posts: 354
- Joined: Jul 30 2010
- Location: Chicago, IL
- Has thanked: 155 times
- Been thanked: 217 times
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.
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.
- TJ
- Posts: 7774
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
you can do it this way to give yourself finer resolution: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.
Code: Select all
if time_s[1] < sessionend*100 and time_s >= sessionend*100 then ...
note the ">="