how to estimate realized volatility using intraday data

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

james123
Posts: 20
Joined: Fri Apr 05, 2013 1:34 pm

how to estimate realized volatility using intraday data

Postby james123 » Fri Apr 05, 2013 2:56 pm

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

james123
Posts: 20
Joined: Fri Apr 05, 2013 1:34 pm

Re: how to estimate realized volatility using intraday data

Postby james123 » Wed May 22, 2013 12:46 pm

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.
Attachments
New Microsoft Office Word 文档.docx
(12.05 KiB) Downloaded 1317 times

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: how to estimate realized volatility using intraday data

Postby trubador » Thu May 23, 2013 3:34 am

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

james123
Posts: 20
Joined: Fri Apr 05, 2013 1:34 pm

Re: how to estimate realized volatility using intraday data

Postby james123 » Wed Oct 23, 2013 7:51 pm

thank you trubador.

:D

james123
Posts: 20
Joined: Fri Apr 05, 2013 1:34 pm

Re: how to estimate realized volatility using intraday data

Postby james123 » Wed Oct 23, 2013 10:39 pm

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
Attachments
data_analysis.xls
(82 KiB) Downloaded 1108 times

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: how to estimate realized volatility using intraday data

Postby trubador » Thu Oct 24, 2013 4:46 am

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.

james123
Posts: 20
Joined: Fri Apr 05, 2013 1:34 pm

Re: how to estimate realized volatility using intraday data

Postby james123 » Sun Oct 27, 2013 5:06 am

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

james123
Posts: 20
Joined: Fri Apr 05, 2013 1:34 pm

Re: how to estimate realized volatility using intraday data

Postby james123 » Sun Oct 27, 2013 7:11 am

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"

james123
Posts: 20
Joined: Fri Apr 05, 2013 1:34 pm

Re: how to estimate realized volatility using intraday data

Postby james123 » Sun Oct 27, 2013 8:28 am

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.

james123
Posts: 20
Joined: Fri Apr 05, 2013 1:34 pm

Re: how to estimate realized volatility using intraday data

Postby james123 » Sun Oct 27, 2013 9:17 am

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.

JoaoAraujo
Posts: 2
Joined: Sun Sep 07, 2014 7:51 am

Re: how to estimate realized volatility using intraday data

Postby JoaoAraujo » Sun Sep 07, 2014 4:21 pm

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.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 2 guests