I tried to forecast VaR(Value at Risk) based on GARCH model using ARCHModels.jl. I found no problem for standard GARCH and TGARCH.

```
using TimeSeries, MarketData, ARCHModels
using Plots, Dates, Missings
startdate = DateTime(2015, 1, 1)
enddate = DateTime(2020, 12, 31)
ihsg_ta = yahoo("^JKSE", YahooOpt(period1 = startdate,
period2 = enddate,
interval = "1d"))
rt = diff(log.(ihsg_ta[:Close]))
y = collect(skipmissing(values(rt)))
```

There is no problem to fit below models!

```
am = fit(EGARCH{3, 1, 2}, y; dist=StdNormal, meanspec=NoIntercept);
vars = VaRs(am, 0.01)
```

but problem occurs when I try to forecast one-step ahead VaR value using below codes (even it worked for standard GARCH and TGARCH)

```
T = length(y);
windowsize = 1000;
vars = similar(y);
for t = windowsize+1:T-1
m = fit(EGARCH{3, 1, 2}, y[t-windowsize:t]; dist=StdNormal, meanspec=NoIntercept)
vars[t+1] = predict(m, :VaR; level=0.01)
end
```

I know that there were problems as discussed here and

here

Is there an error with the second code? I just curious why the first code works,

but the second error. I replicate the code from this manual