Page 1 of 1
how to estimate realized volatility using intraday data
Posted: Fri Apr 05, 2013 2:56 pm
by james123
Hi, is anyone known how to use Eviews 7 to estimate the realized volatility?
Currently I have nearly 50,000 1mins high frequency data, and I need to compare the RV and GARCH model. For my data, each trading day contains four trading hours, and 240mins per day. Is that there has hourly RV and daily RV estimation?
Many Thanks
Re: how to estimate realized volatility using intraday data
Posted: Wed May 22, 2013 12:46 pm
by james123
Hi, can anyone write a code to calculate the following, I attached it in the word document. And this is the fomular to calculate the realized volatility.
Re: how to estimate realized volatility using intraday data
Posted: Thu May 23, 2013 3:34 am
by trubador
You can use the "Frequency Conversion" tools:
Code: Select all
wfcreate(wf=example,page=intraday) 5min(1-5, 8AM-5PM) 1/2/2012 12/31/2012
series r = nrnd/100
series r2 = r^2
pagecreate(page=daily) d5 2012 2012
copy(c=s) intraday\r2 daily\r2
Re: how to estimate realized volatility using intraday data
Posted: Wed Oct 23, 2013 7:51 pm
by james123
thank you trubador.
:D
Re: how to estimate realized volatility using intraday data
Posted: Wed Oct 23, 2013 10:39 pm
by james123
hi, I do not quite understand the floowing Eviews sentence
"series r = nrnd/100" what does this sentence mean?
I attached the data in this reply, can you have a look and help me to estimate the daily realized volatility by using 5 mins interval close price?
thanks a lot
Re: how to estimate realized volatility using intraday data
Posted: Thu Oct 24, 2013 4:46 am
by trubador
It is a hypothetical return series that I created using EViews' random number generator. It is generated for expositional purposes. You should use your own series instead.
Re: how to estimate realized volatility using intraday data
Posted: Sun Oct 27, 2013 5:06 am
by james123
hi, turbador,
Thank you for your reply, but I still think the above program is not fully correct. In order to get realized volatility from daily high frequency data, I think we need to use "if language" to contorl the daily time rolling. The steps to calculate RV are the following:
1: calculate log return, in 5 mins interval, which equlas r=log(close)-log(close(-1));
2: calculate the r squart, r2=r*r
3, then sum up each daily's r2, for example, if there are 4 hours trading time, then for each day there has 48 r squart, then sum up these 48 r2 value, it will give the daily realized volatility.
4. move to next day, and run the above 1-3 again.
5. store all these daily value in a new series.
how to program it?
All the Best
Re: how to estimate realized volatility using intraday data
Posted: Sun Oct 27, 2013 7:11 am
by james123
hi, I try to program the realized volatility as the following ( assume these are 500 days need to be estimated):
!start=0
if !start>=0 and !start<500, then
smpl 1/04/2013+!start 1/04/2013+!start
r=log(close)-log(close(-1))
r2=r*r
v =sum(r2)
save series volatility
!start+1
else
!start >=500
endif
but I am not sure how to perform the followings in eviews:
1: how to sum up the daily r squart, can I use command " sum(r2)"
2: how to save the daily realized volatility, can I use " save series volatility"
Re: how to estimate realized volatility using intraday data
Posted: Sun Oct 27, 2013 8:28 am
by james123
hi, here is the new version:
!start=0
if !start>=0 and !start<500 then
series r
smpl 1/04/2013+!start 1/04/2013+!start
r=log(close)-log(close(-1))
series r2
r2=r*r
series v
v =@sum(r2)
save series volatility
!start=!start+1
else
!start>=500
endif
but the " if cycle" does not work, meanwhile, it gives 48 same realized volatility values per day. I need to merge these 48 values into 1 value, while means delete other 47 values, and put the date from intraday to daily.
Re: how to estimate realized volatility using intraday data
Posted: Sun Oct 27, 2013 9:17 am
by james123
It seems like we need to use "while" or "for" command,
The key problems are two:
1. how to sum up the daily r squart value.
2. how to store the estimated daily realized volatility.
Re: how to estimate realized volatility using intraday data
Posted: Sun Sep 07, 2014 4:21 pm
by JoaoAraujo
Hi James,
Good afternoon.
Have you worked this problem out ?
I'm facing same problem, but my sample is not under date basis :(.
I have 840 days with 79 prices a day and trying to simulate RV as you were...
Appreciate if you solved the issue and could share.