!window = 186
!length =987
series fcast

for !i = 1 to !window
fcast(!i,1)=sp500(!i,1)
next

for !i = 1 to !length-!window
smpl @first+!i-1 @first+!i-2+!window
equation eqf.switchreg(type=markov) eurusd c ar(1) @nv month12 month10 month8 month7 month6 month4 month3
smpl @first+!i-1+!window @first+!i-1+!window
eqf.fit sp500f
fcast(!window+!i,1)=@last(sp500f)   	
next

