These codes compute the high-frequency risk (HFR) measure both in-sample and out-of-sample. For the in sample analysis, we display the parameter estimates of the models used to compute the two components of the measure, namely the EACD model for the TaR and EACD-GARCH for the intraday VaR. Besides, graphics displaying the in sample pattern of the HFR measure (Figures 1 and 2), as well as the deterministic seasonal component of the return and duration series (Figure 3) are provided. For the out-of-sample analysis we present the first 3000 forecasts for the two components of HFR measure (Figure 4): the VaR, the returns and the associated violations on the left panel, as well as the TaR and the durations with their violations on the right panel. Figure 5 shows the evolution of the standardized series of returns and VaR, respectively (as explained in the article). The backtesting results for the three tests and the three hypotheses tested are displayed on the screen as well as the frequency of violations. Figure 6 presents the backtesting results obtained by implementing the procedure over the out-of-sample period on a fixed rolling window of 1 hour. The first part of this figure shows the p-values of the UC test of Christoferssen ('98) for the VaR and TaR forecasts and the last part displays the number of points used to perform the test. To obtain these results run the file appel_HFR.m. The parameters that can be changed manually are: the dataset used (data), the name of the asset (actif), the price change threshold (C), the nominal level of risk (alpha_VaR), the end of the in-sample period (insample_end), the order of the EACD model (p,q) and the size of the forecasts sample used to perform the backtesting procedure. Note that the database should contain the following variables: the date, the mid-quote price, the price, the time of the transaction (number of seconds after the midnight), the lagged time of the transaction, the duration, the name of the day, the index of the day, the lagged index of the day, the price variation, the return, the hour. IN ORDER TO HAVE THE RESULTS OF THE BACKTESTING PROCEDURE CHANGE THE PATHS IN THE FILES backtest_ISIVaR.m and backtest_TaR.m. One can define a less complex database; for this the first part of the file zz_new.m should also be adapted A demo database is provided.
Working Paper (2021)
Couperier Ophélie and Leymarie Jérémy