Hi, I found a script aimed to find the best arima(p,0,d) model as the one with the lowest BIC(or AIC) value in order to use a trading strategy based on ARIMA/GARCH model.
Here I report the code found (including my data):
Currency=xlsread('EURUSD.xls','exchange','A:B');
eur=Currency;
LOGL = zeros(4,4);
PQ = zeros(4,4);
for p = 1:4
for q = 1:4 mod = arima(p,0,q); [fit,~,logL] = estimate(mod,eur,'print',false); LOGL(p,q) = logL; PQ(p,q) = p+q; end
end
LOGL = reshape(LOGL,16,1);
PQ = reshape(PQ,16,1);
[~,bic] = aicbic(LOGL,PQ+1,100);
reshape(bic,4,4)
Ok, it works but in my case, I had already found out that an ARIMA (1,0,0) was the best fit,so my target is to include the "zero" value for "p" or "q" for future needs. The problem is that when p AND q are both zero, it clearly shows error. So I started using "continue" to skip the arima(0,0,0) and compute all other ones but…I always failed (I'm very poor in programming). If someone can help me…. ps: I'm helping myself with a "R" script but obviously I'm using Matlab 🙂
Best Answer