This is the code I used for my Master's Thesis (Dynamic Analysis in Financial Markets). It's written in R