I am studying a high frequency tick by tick data. I want to calculate every 5 minutes volatility. The volatility equation is as follow: P_t^High:the highest price in 5 minutes interval P_t^Low:the lowest price in 5 minutes interval P_t^Open:the opening price(first price) in 5 minutes interval P_t^Close:the closing price(last price) in 5 minutes interval The trading time in this data is from 8:45 to 13:45(5 hours). The 5 minutes interval is defined as:(84500.000-85000.000), (85000.001-85500.000), (85500.001-90000.000),......, (134000.001-134500.000) Here is an example: date account price time 2010/1/4 123 8203 84500.155 2010/1/4 456 8187 84600.116 2010/1/4 789 8194 84700.117 2010/1/4 452 8201 84800.115 2010/1/4 124 8199 84900.115 2010/1/4 477 8197 85000.145 2010/1/4 412 8199 85100.115 2010/1/4 633 8196 85200.123 2010/1/4 521 8198 85300.112 2010/1/4 213 8197 85400.145 2010/1/4 777 8199 85500.144 2010/1/4 216 8195 85600.566 2010/1/4 974 8197 85700.963 2010/1/4 269 8194 85800.419 2010/1/4 536 8196 85900.324 2010/1/4 236 8194 90000.639 The first 5 minutes volatility is from 84500.000 to 85000.000. So it is 1/2(8203-8187)^2-(2ln2-1)(8203-8199)^2. Could you help me how to write the code about volatility equation above?The data format is csv. If you have any problem about my question, please let me know. If you need the whole data, you can download the data I upload. Many thanks for your help. Thanks for sparing your time. Highly appreciate it.
... View more