Moving average model, MA(q) implementation Assuming that I have a Time Series 'X'
which is a 1000 days data of a stock.

can someone share a code sample (in any language)
even pseudo code for the Moving average model order q?
I dont know about your purpose but if you just want to calibrate the model, use R.
i.p
require(smooth)
require(MComp)
sma(data,q)$forecast
Again an R Code: 

 weights&lt;-rep(1/q,q) # or any desired weights  ma&lt;-filter(data,weights,sides=1) 

 plot(data)  lines(ma)  

and you can also take a look at the autocorrelation function  acf(ma,na.action=na.pass)